Running DOS command from Matlab

조회 수: 9 (최근 30일)
sam Pournazeri
sam Pournazeri 2011년 9월 13일
I am running an execution file of a Fortran code in Matlab using DOS command.(I do not have access to the source code though).
The Fortran code is written in a way that print too many parameters on the screen window. Thus, when you run it on Matlab, all these parameters are printed on command window therefore it extremely reduces the SPEED.
Since I do not have any access to the source code, I cannot avoid the fortran code of doing that, but is there any way, not allowing the matlab to print these useless parameters on the command window.
Thanks

채택된 답변

Jason Ross
Jason Ross 2011년 9월 13일
You can redirect the output to a file if you do care about reviewing it later:
system('mycommand > myoutputfile.txt')
or you can just send the output to null
system('mycommand > NUL')
or output and errors if you really don't care at all.
system('mycommand 1 > NUL 2 > NUL')
  댓글 수: 1
sam Pournazeri
sam Pournazeri 2011년 9월 13일
Thanks Jason. That was very helpful.

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

추가 답변 (1개)

sam Pournazeri
sam Pournazeri 2011년 9월 13일
But one more thing, running execution file from matlab using system() still takes much more time than running it from Command prompt window. is there any way to make the timings comparable?
  댓글 수: 1
Jason Ross
Jason Ross 2011년 9월 13일
A theory -- there might be some difference in environment variables between the system command and your "bare" command prompt. Run
system('set')
in MATLAB and also run 'set' at the command prompt, and see if there is something different that might affect the performance of your code. You can try using setenv() to change the command environment before you call system().

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

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by