필터 지우기
필터 지우기

Get the outputs from a script launched by the run function

조회 수: 9 (최근 30일)
grapevine
grapevine 2012년 8월 2일
Hello everyone,
I got an issue while I was working with the run function. I currently use this function to lauch some Matlab scripts from another directory which is not in the matlab path e.g:
CheminData = 'D:.......' ;
ScriptRun='Script2Run.m';
FullPath2Script=[CheminData,'\',ScriptRun];
run(FullPath2Script)
Sometimes these scripts have an output or more than one. The only way that I found to get the script outputs is by using the ans variable e.g
run(FullPath2Script)
outputVariable=ans;
Is there another way to properly obtain the output from a script launched by the run function ?
thanks 4 reading

채택된 답변

Walter Roberson
Walter Roberson 2012년 8월 3일
There is an argument to be made that scripts do not have outputs, that scripts merely have "side effects".
If you want to capture text that is displayed by a script, look at evalc()

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by