Problem with input parameters in executable
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Walter Roberson
2012-4-16
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 个评论
Walter Roberson
2012-4-16
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!