[Top][All Lists]

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

RE: Strings not compatible with Matlab?

From: Julian DeMarchi
Subject: RE: Strings not compatible with Matlab?
Date: Mon, 30 Dec 2002 20:58:42 -0500

. . . 

| >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.
Hmmm.  It definitely worked in Octave when I tested it.  However I did not test 
it with the name evalin, I tested it with the name "function test()".  Perhaps 
that was the bug you meant?  Sorry if so.  

Nor does it work when endfunction is at the end of the file, though it does 
when endfunction is not there.  Hence my deference regarding scope.  I guess 
that somehow endfunction "sutures up" the scope of the function/script.

I was misleading about the num2str() however; this only works when double 
quotes are used.

| >(Octave/forge supports neither assignin nor evalin.)
| >
| octave now supports evalin (cvs version).  

- Julian/MatLinks

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]