help-octave
[Top][All Lists]
Advanced

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

Re: Passing arguments to a script.


From: CdeMills
Subject: Re: Passing arguments to a script.
Date: Tue, 9 Jul 2013 06:04:29 -0700 (PDT)

Richard KIrk wrote
> Hi.
> 
> I was wanting to load a lot of test data using a script. I had one .m file
> for each set of data. In these scripts, the 'load' command would read a
> lot of parameters from a file, and then we had some housekeeping
> operations to make sure the data was all consistent in the current scope.
> I wanted to make a single .m file that worked like this...
> 
>> loadTestData 
> <name>


Another option is to choose some meaningfull variable name, and use that
inside your script to perform some action. Better yet, set this variable as
a cell array, and iterate on the elements.

For instance:

script1:
name={'data1.csv', 'data2.csv'}

script2:
for ii = (1:length(name))
 somevar = load(name{ii});
 do_some_proc
end

You have to choose carefully the way you pass data between scripts,
variables are now all global and may be overwrittent anywhere.

Regards

Pascal






--
View this message in context: 
http://octave.1599824.n4.nabble.com/Passing-arguments-to-a-script-tp4655329p4655428.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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