From: David Young on
I am puzzled by the following (observed in 2009a 64 bit Linux and 2010a 64 bit Windows):

>> [a, b, c] = deal(1, :, 2);
>> strcmp(b, ':')

ans =

1

I can't fit this into any of my mental schema relating to how things should work, or find any documentation that would explain it. I feel I must be missing something (quite possible at 1 am, as it is here) - can anyone shed any light please?

I can't find a bugreport, but I'm beginning to wonder if I've found a bug.

(For anyone who doesn't see the problem: deal is a function, not an array. You'd expect a naked colon to be meaningless as an argument, and for the first line of my example to cause an error. To get a string back is very strange.)
From: Matt Fig on
Using 2007b:

>> [a, b, c] = deal(1, :, 2);
??? At compilation, "deal" was determined to be a variable and this
variable is uninitialized. "deal" is also a function name and previous versions of MATLAB would have called the function.
However, MATLAB 7 forbids the use of the same name in the same
context as both a function and a variable.

What does:
>>which deal
say?
From: David Young on
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <horhtp$q5e$1(a)fred.mathworks.com>...
> What does:
> >>which deal
> say?

>> which deal
C:\Program Files\MATLAB\R2010a\toolbox\matlab\datatypes\deal.m
From: David Young on
Matt: thanks, that's given me something to think about. In 2010a the behaviour you see is preserved (with a shorter message) if there are only 2 arguments to deal:

>> [a, b] = deal(1,:)
??? Undefined variable deal.

I can understand this: if there's a naked colon, then deal must be a variable not a function, it's not defined, so error.

It's looking increasingly as if there is a bug for more than 2 arguments: the function is being called, and a representation of the lexical token is being passed to it without any attempt at evaluation.
From: Matt Fig on
Did they change DEAL.m? Is it still just basically:

varargout = varargin;

or what?
 |  Next  |  Last
Pages: 1 2
Prev: Charging a circuit
Next: FZERO Error