reading an input file and writing an output file name with input values

Hi guys,
I've written a .m file that runs as a script and has several input values and a path to one input file.
I'd like to have an input file that the script reads at the beginning, but I don't know how to have the script read an input file.
I'd also like to create the output file using my fprintf that has a name with some of the input values, that way I know what results go with what inputs. I also don't know how to do that.
any help would be sooooo much appreciated!
Tabby

回答(3 个)

kei hin,
thanks for your willingness to help! I'll post what an input file should be tomorrow morning....
Image Analyst,
I'm really new to MatLab so I didn't know that fgets is the command I need, thanks I'll read about it....
I'm really good at following examples, and I know how to write the usual fprintf statement
{fprintf(fileID,formatSpec,A1,...,An)}
but I don't know how to pass in to fprintf the values form the input file I'll call with fgets, and I haven't found an example of that?
Good morning guys,
Kei Hin, here's what an input file should look like
/home/tabithaL/projects/DK_063/dk_063.mat;
a_start=0;
a_end=400;
a_stepsize=10;
a_spread=5;
r_start=0;
r_end=60;
r_stepsize=5;
r_spread=2;
sampling=0.5;
num_g=2000000000;
del_r=7.5;
and I would like the values of
a_end
a_stepsize
a_spread
del_r
to be in the output file name, something like
400_10_5_7-5_outputfile.dat

类别

在 帮助中心 和 File Exchange 中查找有关 Standard File Formats 的更多信息

标签

提问:

2013-9-5

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by