how to add multiple data files in .exe-file using system command?
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Liset Geijselaers
il 11 Ott 2016
Risposto: Walter Roberson
il 11 Ott 2016
I got an filed called function.exe that I would like to run with Matlab. This file needs three data files to run the program: track.dat, grid.dat and info.dat. I know how to add a single data file using the matlab command system:
status=system(['function.exe<','track.dat'])
When i try the function below the response of matlab is "The system cannot find the file specified"
status=system(['function.exe<','track.dat','grid.dat','info.dat'])
Does someone know how to add multiple input files in an .exe-file?
0 Commenti
Risposta accettata
Walter Roberson
il 11 Ott 2016
You could try
status=system('function.exe track.dat grid.dat info.dat')
The syntax you used with '<' is only for the case of "standard input", what the user would type if the program were run without using the '<' . There can only be one standard input file. The syntax I used is for the case where the program reads its command arguments and knows what to do with the names listed.
There is another possible interpretation for what you want to do. It could be that the program reads asking for file names to process, and you want to provide the string 'track.dat' in response, whereas your current code would provide the content of track.dat . If you are trying to provide the three file names as strings as if the user had typed them in when prompted, then use
tname = tempname();
fid = fopen(tname, 'wt');
fprintf(fid, 'track.dat\ngrid.dat\ninfo.dat\n');
fclose(fid);
status = system( sprintf('function.exe < "%s"', tname) );
delete(tname);
What this is doing is creating a temporary file to hold those strings, and then sending the content of the file as input to the program, and afterwards deleting the file.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Database Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!