dos/system error
3 次查看(过去 30 天)
显示 更早的评论
I am trying to run an EXE from the MATLAB (r2010b on Windows XP) command prompt, and am not able to do so.
I can easily use
dos('dir');
and list the contents of the directory, but running my EXE like:
dos('segment 0.8 100 100 tmpim1269868.ppm tmpimsp1269868.ppm');
does not work. The command prompt is available to me almost instantaneously, and the ans variable contains the value -1.0737e+9.
I am able to run the EXE from a DOS prompt with the exact same command, and generate the correct result, but when the DOS prompt is called from MATLAB, it just doesn't seem to be working. I have tried creating a BAT file containing the execution call in the directory and running the same by using the dos command, but to no avail.
The same occurs when I use system instead of dos.
Any advice at all would be appreciated.
0 个评论
采纳的回答
更多回答(1 个)
Jan
2011-5-25
Do you catch the 2 output arguments from the DOS command? ANS should be 0 for successful processing, and not 0 otherwise. Try:
[a, b] = system(['segment 0.8 100 100 ', ...
'tmpim1269868.ppm tmpimsp1269868.ppm']);
Are you sure that "segment.exe" and the picture(s) is(are) available in the current folder? Does an error message appear in the output [b]?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!