matlab -r in shell not work

조회 수: 17 (최근 30일)
PanZhang Zhang
PanZhang Zhang 2022년 9월 21일
편집: Jan 2022년 9월 21일
I have shell script naming test.sh with code like follows in it:
matlab -nodisplay -nosplash -nodesktop /r "test('$a','$b')"
then i run the test.sh in windows10, the matlab command windows is opened but my matlab function test not execute in the window. I want to know why, and how to fix it.
  댓글 수: 4
Steven Lord
Steven Lord 2022년 9월 21일
What does "not execute" mean in this context?
  • Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
  • Does it do something different than what you expected? If so, what did it do and what did you expect it to do?
  • Did MATLAB crash? If so please send the crash log file (with a description of what you were running or doing in MATLAB when the crash occured) to Technical Support so we can investigate.
PanZhang Zhang
PanZhang Zhang 2022년 9월 21일
편집: Jan 2022년 9월 21일
for example,here is my test.m file content:
function test(a,b)
c=a+b;
disp(c);
end
when i run command: matlab -nodisplay -nosplash -nodesktop /r "test(1,2)" in powershell,
it opens a matlab command window, and showing result "3" on a new line in the window,
but when i run the same command in a shell script. it just opened a new matlab command window,then nothing happened just like my function test in the test.m without running.
about your confusion:
  • I did not get any warning or error messages.
  • I expect the test function will be performed in the opened matlab command window,the result 'c' should be displayed in the window.
  • Matlab not crashed, the command window should be able to run matlab command without opening matlab main ui when with argument '-nodesktop'.

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

답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by