Problem with input parameters in executable
2 views (last 30 days)
Show older comments
Hello Everyone
I have a serious problem when trying to run an executable (exe file) written in C++. The executable itself works fine and I am able to run it using the " system('dir') " function.
The problem occurs as at the same time when the exe is run through cmd, must be followed by 12 parameters.
The first parameter should be an image, and the rest 11 numbers.
I tried to follow the tutorial found here with no success:
My code looks like:
I=imread('ras_14.tif');
F=[0 1 2 18 125 15 5 0.3 5 1 0.2];
%[stat,res]=system(['C:\Master_Geomatics\Edgeflow-based Anisotropic diffusion\Software\main.exe ',I ,F ]);
The error I am getting is
??? Error using ==> horzcat CAT arguments dimensions are not consistent.
I know that this is caused by the size of the elements within the vector but these are also the inputs that the executable needs so it can run.
The executable I am trying to run can be found here
I would appreciate any help, cause I am stuck !
Thank you in advance
0 Comments
Answers (2)
Walter Roberson
on 16 Apr 2012
How is the executable receiving the parameters? If it is receiving them on the command line then you need to convert them to text, such as
[stat,res]=system(['C:\Master_Geomatics\Edgeflow-based Anisotropic diffusion\Software\main.exe ', 'ras14.tif', num2str(F) ]);
2 Comments
Walter Roberson
on 16 Apr 2012
You have a space in your path. When you send that through system() it is being interpreted as the end of the command. You would need to quote the command with double-quotes ( "C:\...whatever" ) or else cd to there like you show.
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!