help-octave
[Top][All Lists]
Advanced

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

Re: inconsitency in behavior of 'size'


From: Sergei Steshenko
Subject: Re: inconsitency in behavior of 'size'
Date: Sat, 10 Mar 2018 13:26:18 +0000 (UTC)





________________________________
From: Mike Miller <address@hidden>
To: "address@hidden" <address@hidden> 
Sent: Saturday, March 10, 2018 10:44 AM
Subject: Re: inconsitency in behavior of 'size'


On Fri, Mar 09, 2018 at 21:42:37 +0000, Sergei Steshenko wrote:
> I don't agree with that. Because the final result, which is 
> [_1,_2], is the same - regardless whether I do the assignment as
> 
> ([_1,_2] = sort(im(:, 3), "descend"))
> 
> or
> 
> [_1,_2] = sort(im(:, 3), "descend").

Then that seems to be where your misunderstanding is. Both of those
statements are equivalent, but the syntax [_1,_2] on the left hand side
of the assignment is not a matrix, it is a comma-separated list.

https://www.gnu.org/software/octave/doc/interpreter/Comma-Separated-Lists.html
https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html


-- 
mike

-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018

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

"it is a comma-separated list" - again, doesn't make sense to me.

Because you are telling me that <FOO> and (<FOO>) are different.

And exactly because of my familiarity with "C" I consider them to be the same, 
and the parenthesis are just for readability.

I.e. in "C"

foo = bar = f(doo); and "foo = (bar = f(doo));" is the same, and "if(foo = 
f(doo))" and "if((foo = f(doo)))" are the same, though the compiler rightly 
suggests parenthesis in the former case because it suspects the programmer 
meant '==' instead of '='.

...

Never mind, Matlab/Octave language sucks anyway.


--Sergei.


reply via email to

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