필터 지우기
필터 지우기

Return the output of an eval function

조회 수: 2 (최근 30일)
Jesse McMullen
Jesse McMullen 2015년 10월 13일
댓글: Walter Roberson 2015년 10월 13일
I am trying to read the status of an external program that I call from a matlab function. The program is called testConn.exe. I call the program like this:
commandSTR = ['!testConn upload ' ipAddress ' testLink];
eval(commandStr);
when I run the function everything works and I see a status message from testConn in the command window with a status message like:
exit status 0 (No errors)
or
exit status 8 (No connection)
My question is how do I capture those status returns so that I can use them for error control? I should add that when I try something like
a = eval(commadSTR);
I get an error from matlab saying unexpected matlab operator; Is there an alternative to the eval function?
Thanks,
Jesse

답변 (1개)

Geoff Hayes
Geoff Hayes 2015년 10월 13일
Jesse - perhaps try using system. You may be able to do something like
status = system(commandSTR);
which may capture the exit status of the command.
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 10월 13일
See also evalc(), but system() is better for this purpose.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by