help-octave
[Top][All Lists]
Advanced

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

Re: Is there an Octave equivalent to the Matlab ASSIGNIN function?


From: Pål Frenger
Subject: Re: Is there an Octave equivalent to the Matlab ASSIGNIN function?
Date: Thu, 20 Dec 2001 09:24:58 -0600

This is a multi-part message in MIME format.
--------------3EBD58663D00CF8B1FB5AE20
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Thanks a lot for you help Paul!
I'm sure I can work something out from this :-)
//Pål

Paul Kienzle wrote:

> It should be possible to write assignin('base',n,V) as a .cc file by adding
> or modifying the variable in top_level_sym_tab.  Alternatively, you could use
>         eval(['global ', n, '; ', n, '=V;'])
> but you will need to define the variable as global in the top level context
> to access it.
>
> There is no way to write assignin('caller',...) without modifying the
> octave interpreter.  To get the effect of assignin('caller',...), you could
> write my_load so that it returns a structure and expand the structure
> using:
>
>         for [key,val] = my_load(...)
>             eval([key "=val;"]);
>         end
>
> Or you could write my_load as a script (not a function!!) which expects the
> name of the file to be in a particular variable before it is invoked.  You
> have to be a lot more careful with your variables in the my_load script,
> though, since they might collide with those in the "caller".
>
> Or you could use the global variable solution I suggested for 'base'.
>
> Paul Kienzle
> address@hidden
>
> On Wed, Dec 19, 2001 at 12:00:19PM -0600, Pål Frenger wrote:
> >
> > Hi,
> >
> > I have a lot of binary files that I have created using C++. I have written 
> > a function "my_load.m"
> > that reads this binary file format into Matlab. Now I want to convert 
> > "my_load.m" so that it works
> > also in Octave. Therefore I need something similar to the Matlab assignin 
> > function:
> >
> > >help assignin
> > >
> > > ASSIGNIN Assign variable in workspace.
> > >    ASSIGNIN(WS,'name',V) assigns the variable 'name' in the
> > >    workspace WS the value V.  WS can be one of 'caller' or 'base'.
> >
> > Is there any Octave equivalent to this function, or any work-around, that I 
> > can use to get my
> > variables from the file into Octave?
> >
> > Grateful for any help on this topic.
> >
> > //Pål Frenger

--------------3EBD58663D00CF8B1FB5AE20
Content-Type: text/x-vcard; charset=us-ascii;
 name="pal.frenger.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Pål Frenger
Content-Disposition: attachment;
 filename="pal.frenger.vcf"

begin:vcard 
n:Frenger;Pål
tel;cell:+47 (0)709 783 444
tel;fax:+46 (0)8 585 314 80
tel;home:+46 (0)8 624 30 70
tel;work:+46 (0)8 75 70 152
x-mozilla-html:FALSE
url:http://eratu.ericsson.se/users/erapall/
org:Ericsson Research;Ericsson Radio Systems AB
adr:;;Torshamnsgatan 23, Kista KI/ERA/T/UR;;;SE-164 80;Sweden
version:2.1
email;internet:address@hidden ICQ: 17558425 
title:Ph.D.
note:Private email: address@hidden
x-mozilla-cpt:;20624
fn:Pål Frenger
end:vcard

--------------3EBD58663D00CF8B1FB5AE20--



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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