no gui result different from gui

조회 수: 2 (최근 30일)
Hao Chen
Hao Chen 2018년 12월 17일
편집: Jan 2018년 12월 18일
I run matlab 2018a on ubuntu 16.04.
When I open gui and run the code, I got result 0.86
When I use no gui
screen
matlab -nodisplay -nodesktop -nosplash <t2_esc.m> t2_esc.txt &
screen -d
I got result 0.93
That is exactly the same code. Does anyone know why?
By the way, specific random seed, rng(0)
  댓글 수: 2
Kevin Chng
Kevin Chng 2018년 12월 17일
I just wondered, will the value of t2_esc.txt considered as char put into your function t2_esc.m?
Hao Chen
Hao Chen 2018년 12월 18일
No, t2_esc.txt is a log file, the output of command window.

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

답변 (1개)

Jan
Jan 2018년 12월 17일
There is no magic flag for changing the results if Matlab is called without GUI. Therefore you can be sure that you instruct Matlab to calculate something different. Perhaps you have two different files called t2_esc.m, so if Matlab starts without GUI you are in a different folder and process another file. Or the calculations include a dependency to the settings of the GUI. Without seeing the code it is impossible to guess the reasons.
Do these two calls reply the same results?
matlab -nodisplay -nodesktop -nosplash <t2_esc.m> t2_esc_a.txt &
matlab <t2_esc.m> t2_esc_b.txt &
  댓글 수: 2
Hao Chen
Hao Chen 2018년 12월 18일
I just tried your suggestion and both gives me 0.93, with the following commands,
matlab -nodisplay -nodesktop -nosplash <t2_esc.m> t2_esc_a.txt &
matlab <t2_esc.m> t2_esc_b.txt &
but I if I open matlab using
matlab &
and open t2_esc.m and hit F5.
it still gives me 0.86
Jan
Jan 2018년 12월 18일
편집: Jan 2018년 12월 18일
Then add this to the function:
disp(mfilename('fullpath'))
to show, if you really use the same files.
What about:
matlab -r "t2_esc" &

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

카테고리

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