[scilab-Users] Another beginner question

Sébastien Bihorel pomchip at free.fr
Thu Nov 12 14:16:23 CET 2009


OK,

The whole expression has to be evaluated rather just the right part (ie the
function call).

Thanks a lot


On Thu, Nov 12, 2009 at 2:59 AM, Collette yann <yann.collette at scilab.org>wrote:

> Sébastien Bihorel a écrit :
>
>  Hi,
>>
>> While translating some Matlab to Scilab, I stumbled upon some issues with
>> problems with the eval function. I don't quite get why the 'eval 6'
>> statement of the following code returns an error (and not the 'eval 3'
>> statement), and would appreciate any explanation.
>>
>> Thank you
>>
>> Sebastien
>>
>>
>> function [b]=test(z)
>>  b = 1;  endfunction
>>
>> function [x,y]=test2(z)
>>  x = 1;
>>  y = 2;             endfunction
>>
>> b=test(2)                // eval 1
>> b=evstr('test(2)')       // eval 2
>> b=eval('test(2)')        // eval 3
>>
>> [x,y]=test2(2)           // eval 4
>> [x,y]=evstr('test2(2)')  // eval 5
>> [x,y]=eval('test2(2)')   // eval 6
>>
>>
>>  eval returns the value of the evaluation of a matrix of strings.
> If there is one string, eval returns 1 value, if there is 2 strings, eval
> returns 2 values.
> If you want to get several parameters of a function, use execstr:
>
> execstr('[x,y] = test2(2)');
>
> YC
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20091112/6e9f92c4/attachment.htm>


More information about the users mailing list