Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Can Someone Explain this Matlab Behavior?
Replies: 4   Last Post: Jan 29, 2011 9:19 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Alan

Posts: 151
Registered: 7/24/09
Re: Can Someone Explain this Matlab Behavior?
Posted: Jan 28, 2011 4:41 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Zampano <zaccone@gmail.com> wrote in message <a6cbf5c8-fbfc-4683-9ca0-8522bcbb2c17@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 space-delimited strings, instead of comma-delimited 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')



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.