[Top][All Lists]

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

Re: Strings not compatible with Matlab?

From: Paul Kienzle
Subject: Re: Strings not compatible with Matlab?
Date: Mon, 30 Dec 2002 18:42:54 -0500
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2.1) Gecko/20021130

Julian DeMarchi wrote:

There's also the poor man's (older Matlab) hack -- basically same as the above 
-- declaring

        function assignin(ws,name,v);
                evalin(ws, [name '=' num2str(v)]);

..which works because num2str() acts more accurately as if it would be called 
makestr() (turns anything into type string, meaning the function does not break 
even when v is not numeric).

As for Octave, if you hack

        function evalin(ws,name,v);
                eval([name '=' num2str(v)]);

Then you're all set.
I believe you mean assignin here.  Regardless, it will not work.  If
it does, that means there is a bug in octave.

(Octave/forge supports neither assignin nor evalin.)

octave now supports evalin (cvs version).
Disclaimer: Note however I am not entirely clear on how Octave variable scope is handled. I notice that the above example works fine in octave so long as endfunction is not used to conclude function evalin().
Paul Kienzle

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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