From: Marco Uzielli on
Hello, I would like Matlab to execute several consecutive DOS commands. The commands are related in the sense that the (i+1)th command requires a text file that is the output from the i-th command. This means that the files required to run the 2nd command (and following) do not exist at the beginning of the sequence. Also, I would need Matlab to automatically generate the name of the output files (to be saved in the directory and to be used for the subsequent commands).

For instance:

command 1: INSTRUCTION 1 <INPUTFILE 1> <OUTPUTFILE 1>
command 2: INSTRUCTION 2 <OUTPUTFILE 1> <OUTPUTFILE 2>
......
command N: INSTRUCTION N <OUTPUTFILE N-1> <OUTPUTFILE N>

where the names <INPUTFILE1> and >OUTPUTFILE #> are generated automatically by Matlab and the corresponding text files are saved to a user-defined directory.

How can this be achieved in Matlab?
From: us on
"Marco Uzielli" <muz(a)georisk.eu> wrote in message <hquagb$286$1(a)fred.mathworks.com>...
> Hello, I would like Matlab to execute several consecutive DOS commands. The commands are related in the sense that the (i+1)th command requires a text file that is the output from the i-th command. This means that the files required to run the 2nd command (and following) do not exist at the beginning of the sequence. Also, I would need Matlab to automatically generate the name of the output files (to be saved in the directory and to be used for the subsequent commands).
>
> For instance:
>
> command 1: INSTRUCTION 1 <INPUTFILE 1> <OUTPUTFILE 1>
> command 2: INSTRUCTION 2 <OUTPUTFILE 1> <OUTPUTFILE 2>
> .....
> command N: INSTRUCTION N <OUTPUTFILE N-1> <OUTPUTFILE N>
>
> where the names <INPUTFILE1> and >OUTPUTFILE #> are generated automatically by Matlab and the corresponding text files are saved to a user-defined directory.
>
> How can this be achieved in Matlab?

a hint
- pseudocode...

1) create a bat file using ML's io functions...
2) execute it using one of ML's system commands

help fopen;
help fwrite;
help fprintf;
help fclose;
help system;
help dos;

us