On 1/29/19 4:01 PM, Andrew Janke wrote:
> In Matlab, statements (including assignment) and compound expressions
> (multiple expressions joined by semicolons or commas) are allowed in
> eval. All your examples work.
Thanks.
> If you use the output-capturing form `x = eval(expr)` then it needs to
> be a single non-compound, non-assignment-statement expression.
Does this appear to be a restriction on parsing or evaluation? In other
words, does something like
x = eval ('y = 1')
fail to parse the assignment statement or does it perform the assignment
to Y and then fail to assign anything to X because (as I remember
anyway) assignments in Matlab are statements and do not produce values.
Similarly, if you try
x = eval ('for i = 1:3, i, end')
does the error happen when parsing the for loop statement or after the
loop is executed (no value to assign)?
jwe