help-octave
[Top][All Lists]
Advanced

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

Re: Use a script to pass parameters to and run another script file


From: Ben Abbott
Subject: Re: Use a script to pass parameters to and run another script file
Date: Tue, 30 Dec 2008 17:50:11 -0500


On Dec 30, 2008, at 5:25 PM, babelproofreader wrote:


I have a script file that reads data from a text file, performs some
operations on the data and writes the results out to another text file. This operation needs to be run many times, each time using a different data text file and writing the results out to separate "results" text files. Is there a way in which the above script file can be run from a second script file, this second script file passing the name of the required data text file to be read prior to operations, and indicating the text file name that the
results should be saved as?

Your first script file would be
-----------------------------
file_to_read = "data.txt"
file_to_write = "results.txt"
process_data (file_to_read, file_to_save)
-----------------------------

Your second function script would be
-----------------------------
function process_data (file_to_read, file_to_save)
.
.
.
endfunction
-----------------------------

Place your script between the function/endfunction lies and save the second function script with the name "process_data.m". You can use a different name, but be sure to change the function name (1st line) as well.

Is that what you'd like to do?

Ben



reply via email to

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