[Top][All Lists]

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

Re: Evaluating a string in octave

From: David Bateman
Subject: Re: Evaluating a string in octave
Date: Mon, 29 Jan 2007 20:47:43 +0100
User-agent: Thunderbird (X11/20060921)

antonio palestrini wrote:
>>>  either:  z=inline(q); z(5)
>>>  or:      inline(q)(5);
>> wonderful short code!!!!
>> It works, even in my octave 2.1.69, with many parameters in the string!
>> And you don't have to remember upper case of parameters :-)
>> [oct 8]  q="2-k+h+f-g";
>> [oct 9]  z=inline(q)(5,2,2,2)
>>  z = 5
> Dear Doug,
> the help of inline says that arguments are extracted
> in alphabetic order ("i" and "j" are not considered) so for people
> like me that are usually so abstracted is better to write
>  q= "2 + f - g + h - k
> have a good work!
> antonio

inline is really deprecated in matlab/octave and function handles should
be used... Note though that you can explicitly state what the variables
are including their order. Consider

octave:3> inline('y-x','y','x')(2,1)
ans =  1
octave:4> inline('y-x')(2,1)
ans = -1


reply via email to

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