[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eval function: Request for Matlab output
From: |
Oliver Heimlich |
Subject: |
Re: eval function: Request for Matlab output |
Date: |
Sat, 07 Nov 2015 15:10:12 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 |
On 07.11.2015 14:14, John W. Eaton wrote:
> On 11/07/2015 06:58 AM, Oliver Heimlich wrote:
>> Matteo,
>>
>> thanks. I can identify the following differences between Octave and
>> Matlab:
>>
>> 11
>> x = eval ('12')
>>
>> `ans` returns 12 in Octave and 11 in Matlab.
>>
>> 13
>> x = eval ('14;')
>>
>> `ans` returns 14 in Octave and 13 in Matlab.
>>
>> 15
>> x = eval ('16');
>>
>> `ans` returns 16 in Octave and 15 in Matlab.
>>
>> 17
>> x = eval ('18;');
>>
>> `ans` returns 18 in Octave and 17 in Matlab.
>>
>> Summing up, the eval'ed code has no influence on the last returned value
>> of the current context in Matlab, but has in Octave. I am going to file
>> a bug report.
>
> I'm a bit confused here. Is that only true if the result of eval is
> assigned to a variable?
>
> jwe
>
Yes. If you did not assign the result of eval to a variable, it would
naturally be the “last result” in the current context and may correctly
be returned by `ans`.
Oliver