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!