How can I launch a specific version of MATLAB from Windows' command prompt with matlab command?

조회 수: 98 (최근 30일)
I'm trying to execute MATLAB command from Windows 7's command prompt. So far I managed to get the result by the following command.
matlab -nosplash -nodesktop -minimize -r "rand(10)" -logfile C:¥TEMP¥logfile.txt
However, I noticed that this will invoke the latest MATLAB version I have installed (R2014b), while I want to run R2014a instead.
Looking at the help document on matlab (Windows) below, I can't find a way to specify the MATLAB version while using the matlab command. It seems that the matlab command for unix system does have that option.
Does this mean that I can't invoke R2014a from the commmand prompt while R2014b is also installed? Do I have to uninstall R2014b in order to call R2014a from the command prompt?

답변 (2개)

Rajesh Gangireddy
Rajesh Gangireddy 2019년 7월 17일
I know this thread is super old.
Still i will answer for the ones who stumble here after searching.
I have mutliple versions of matlab ranging from 2013b to 2018, 2013b being default.
To run a command/m file with a particular matlab version, I tried
"C:\Program Files\MATLAB\R2018b\bin\matlab.exe" -nosplash -nodesktop -minimize -r magic(5)
and it works.
You can run this durectly on cmd prompt or by creating a batch file.
Just replace magic(5) with your m file or command.
  댓글 수: 1
Taylor Gardner
Taylor Gardner 2022년 10월 3일
I was getting an error using "C:\Program Files". Command line didn't like the space. So, I used the short path . . .
"C:\PROGRA~1"
That worked for me.

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


Kouichi Nakamura
Kouichi Nakamura 2015년 4월 6일
Maybe one way to avoid invoking MATLAB R2014b is to temporally remove it from the System Environment Variables? SET PATH command's result contains the following path. I can edit it from Computer > Properties > Advanced System Settings > Advanced > Environment Variables... > System Environment Variables > Path > Edit...
C:Program Files\MATLAB\R2014b\runtime\win64

카테고리

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