Reputation:
I have an executable which when run asks for the name of the parameter file. I have tried all styles of inputting the parameter file's name but I get the same error which is:
GAM Version: 2.905
ERROR - the parameter file does not exist,
check for the file and try again
Stop - Program terminated.
ans =
0
The name of the parameter file is gam.par
. The various styles that I have tried for the function to automatically read the parameter file's name are:
system('"gam.exe" -f "gam.par"')
system('"gam.exe" -f "gam.par"')
system('"gam.exe" -f gam.par')
system('gam.exe -f gam.par')
system('"gam.exe" /f gam.par')
system('"gam.exe" /f gam.par /o gam.out')
system('"C:\Users\...\gam.exe" /f gam.par /o gam.out')
system(['"C:\Users\...\gam.exe" /f gam.par /o gam.out'])
Where gam.par
and gam.par
are parameter (input) file and output file, respectively. However, in each of the above case I get the same error message as shown in the beginning.
All my files (input, output, executable etc.) are in same folder. If I use the system() function without using the parameter file's name then it runs without fault and prompts me to enter the parameter file name and when I enter the same file name (i.e. gam.par
) on prompt then everything works fine. I want to be able to do that automatically by entering the parameter file name inside the system() argument rather than entering manually on prompt. It will be helpful if anyone can determine why I am not able to get what I am trying to do. Thanks!
Upvotes: 2
Views: 2734
Reputation: 1
Run program in console:
\\location\My programm.exe 'param 1' 'param 2'
Run program in Matlab:
system(['location\my proramm.exe' '"param 1"' '"param 2')
pathApplicationForm = strcat('"C:\Users\Master\Google Drive\Bakalaura Darbs\Application Development for the Microscopic Models Calibration\Application Form\bin\Debug\Application Form.exe"');
runParam = strcat(get(vEdit2,'String'), '\', get(vEdit3,'String'));
VISSIM = strcat(get(vEdit1,'String'));
system([pathApplicationForm ' "' VISSIM '" "' runParam '']);
It's working ^^
Upvotes: 0
Reputation: 124563
Here is an example. Imagine you had a text file at: C:\filename.txt
:
system('type c:\filename.txt')
Now if the file had spaces in its name (or its path), you need to use double quotes:
system('type "c:\my filename.txt"')
Upvotes: 2
Reputation: 4255
According to this page from Mathworks, the syntax is:
system('filename parameter1 parameter2...parameterN')
or in your case:
system('gam.exe gam.par')
Notice the single quotes around the entire argument as well as the spaces between each parameter being passed to the executable application. There is also the full product documentation but I find it less clear than my previous link.
Upvotes: 2