From help-octave-request at bevo dot che dot wisc dot edu Mon Dec 30 17:42:38 2002 Subject: Re: Strings not compatible with Matlab? From: Paul Kienzle To: Julian DeMarchi Cc: James Frye , "John W. Eaton" , help-octave@bevo.che.wisc.edu Date: Mon, 30 Dec 2002 18:42:54 -0500 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 pkienzle at users dot sf dot net ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------