Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Alan
Posts:
151
Registered:
7/24/09


Re: Can Someone Explain this Matlab Behavior?
Posted:
Jan 28, 2011 4:41 PM


Zampano <zaccone@gmail.com> wrote in message <a6cbf5c8fbfc46839ca08522bcbb2c17@o39g2000prb.googlegroups.com>... > Matlab allows me to call the size function without parentheses. When > I do, I get unexpected results. See the example below. What's going > on? I'm using Matlab R2010a on a Mac. > > Rick > > >> r = [1 2 3] > > r = > > 1 2 3 > > >> size r > > ans = > > 1 1 > > >> size(r) > > ans = > > 1 3 > > >> r2 = size r > ??? r2 = size r >  > Error: Unexpected MATLAB expression.
That's called "command syntax", as opposed to "function syntax". It's like a Unix commands  the arguments are spacedelimited strings, instead of commadelimited expressions. No result is returned, so trying to assign the nonexistent output to a variable gives an error.
size r is equivalent to size('r')



