help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error in a Matlab toolbox. Problem with" cellfun".


From: David Grundberg
Subject: Re: error in a Matlab toolbox. Problem with" cellfun".
Date: Tue, 03 Nov 2009 15:20:37 +0100
User-agent: Thunderbird 2.0.0.21 (X11/20090302)

Philipp Leser wrote:

Hey,

I try to play around with the Matlog (http://www.ise.ncsu.edu/kay/matlog/)toolbox and run it on Octave. It’s quite interesting since I can run Matlog on MATLAB at the university and compare it to Octave. On Matlab the Matlog toolbox runs quite smooth, but on Octave I get some error messages. To me it is an educating experience on the few incompatibilities of the two tools.

Here is one error I really have trouble understanding. Would be happy about any hints or help.

I run the function “vrpsavings”. The function itself calls a function called LocTC in an “try and catch” construction:

“try % Use for error checking and to store input arguments

locTC([],C,cap,twin,locfeas);

catch

errstr = lasterr;

idx = find(double(errstr) == 10);

error(errstr(idx(1)+1:end))

end “;

where C is a NxN matrix, cap a cell object and twin locfeas are a [] double.

In the line “ locTC([],C,cap,twin,locfeas)” I get the error message.

“error: cellfun: second argument must be a cell array

error: evaluating argument list element number 1

error: evaluating argument list element number 1

error: called from:

error: C:\Octave\3.2.2_gcc-4.3.0\bin\matlog\locTC.m at line 180, column 1

error: C:\Octave\3.2.2_gcc-4.3.0\bin\matlog\vrpsavings_test.m at line 54, column 1

“

In “locTC” line 180 to 186

“

if isfirstcall & ~isempty(loc) & (~(isreal(loc) | iscell(loc)) | ...

(~iscell(loc) & (min(size(loc)) ~= 1 | ...

any(loc(:) < 1 | loc(:) > n))) | ...

(iscell(loc) & (any(cellfun('prodofsize',loc) ~= ...

cellfun('length',loc)) | any([loc{:}] < 1 | [loc{:}] > n))))

error('"loc" not a valid loc seq.')

end

“

When I run the “vrpsavings” file in the Matlab debugger, the “locTC([],C,cap,twin,locfeas)” returns “inf”, but no error.

Why? I don’t get it.

Thanks in advance

cheers

------------------------------------------------------------------------

_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Try replacing the & in the if-condition with &&, and | with ||. The && and || operators short-circuit, the & and | operators do not. Seems like that condition was written with short-circuit boolean logic in mind (rather than bitwise logic).

hth
David


reply via email to

[Prev in Thread] Current Thread [Next in Thread]