フィルターのクリア

Shut down Matlab and open new Matlab instance

3 ビュー (過去 30 日間)
Rupesh
Rupesh 2014 年 3 月 6 日
コメント済み: Walter Roberson 2018 年 2 月 6 日
I want to close the current Matlab instance and open the new Matlab instance through Matlab command or script...Any inputs??

回答 (3 件)

Srinivas
Srinivas 2014 年 3 月 6 日
something like this
Curr_dir = pwd;
bat_str = ['"' matlabroot '\bin\matlab.exe' '"'];
fid = fopen('restart_matlab.bat','w');
fprintf(fid, '%s\n', ['cd ' Curr_dir]);
fprintf(fid, '\n%s', bat_str);
fclose(fid);
system('restart_matlab.bat')
exit
HTH
  2 件のコメント
Rupesh
Rupesh 2014 年 3 月 10 日
Thank you Srinivas for the answer. I implemented your suggestion. Its working as per my expectations. But it is creating one .bat (restart_matlab.bat) file. Is it possible to have same functionality without generation of additional files(here, .bat file)..
Once again Thank you for the earlier reply and looking forward for the response
Srinivas
Srinivas 2014 年 3 月 10 日
just delete the bat file
Curr_dir = pwd;
bat_str = ['"' matlabroot '\bin\matlab.exe' '"'];
fid = fopen('restart_matlab.bat','w');
fprintf(fid, '%s\n', ['cd ' Curr_dir]);
fprintf(fid, '\n%s', bat_str);
fclose(fid);
system('restart_matlab.bat')
delete('restart_matlab.bat')
exit

サインインしてコメントする。


Andreas Goser
Andreas Goser 2014 年 3 月 6 日
In a release a couple of years ago, I created a "finish.m" on the path and within the file it was just "matlab".
When closing MATLAB, with would run finish.m and while closing MATLAB it would start another one.
  4 件のコメント
Sean de Wolski
Sean de Wolski 2014 年 3 月 10 日
@Andreas, I assume you need to have the '&' after 'matlab' otherwise it will hold closing the first session until the second has closed.
Andreas Goser
Andreas Goser 2014 年 3 月 10 日
Maybe... I haven't tried. This is what I did probably 8y ago ;-)

サインインしてコメントする。


Sean de Wolski
Sean de Wolski 2014 年 3 月 10 日
system('matlab &');exit
  5 件のコメント
AA
AA 2018 年 2 月 6 日
Hello @per,
Is there a way to do it on Linux? I tried the above command, it shows the startup screen but does not launch a new window?
Thanks!
Walter Roberson
Walter Roberson 2018 年 2 月 6 日
system('nohup matlab 2>&1 &')

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by