フィルターのクリア

input does not work in startup file on matlab 2013a and 2013b

1 回表示 (過去 30 日間)
Alex
Alex 2013 年 11 月 7 日
編集済み: Jeffrey Chiou 2014 年 6 月 25 日
We have historical startup.m file, which asks user on what kind of software he wants to choose during startup (conflicting software) e.g.
ch=input('type a if you want to use a and anything else if b','s')
if strncmpi(ch,'a',1)
... initialize a
else
... initialize b
end
Everything was working fine in earlier versions of Matlab, but 2013a and 2013b just sits on blinking cursor. you have to guess and type something -- then it goes further.
It also works fine if one types startup on initialized session, namely:.
>>startup
it also generates java error message:
java.lang.ClassCastException: com.mathworks.jmi.types.MLArrayRef cannot be cast to java.lang.String
at com.mathworks.appmanagement.GetAppInstallDirectoryWorker.doOnMatlabThread(GetAppInstallDirectoryWorker.java:20)
at com.mathworks.appmanagement.GetAppInstallDirectoryWorker.doOnMatlabThread(GetAppInstallDirectoryWorker.java:7)
at com.mathworks.appmanagement.AbstractAppManagementMatlabWorker.runOnMatlabThread(AbstractAppManagementMatlabWorker.java:21)
at com.mathworks.jmi.MatlabWorker$2.run(MatlabWorker.java:79)
at com.mathworks.jmi.NativeMatlab.dispatchMTRequests(NativeMatlab.java:440)
but this is may be something to do with the software itself which uses com, though it works for other software and not during the startup process. Does anybody know how to deal with this annoying issue?

回答 (4 件)

Alex
Alex 2013 年 11 月 20 日
No, I did not. But in alternative threads here was discussion about the way Java is initiated now and the conclusion is that current matlab do not support whole set of matlab commands in startup file.
it is certainly a bug which was present in Matlab 2011, solved in Matlab 2012 and then gradually appeared again in Matlab 2013.
Can not bother to file a bug report, as they are seems read by sales peoples -- not by tech and this comes to long useless conversation on what I should buy in addition...
  1 件のコメント
Sean de Wolski
Sean de Wolski 2013 年 11 月 20 日
I can assure you that our appropriate development teams are aware of this and I've added your feedback.

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


Thomas
Thomas 2013 年 11 月 20 日
編集済み: Thomas 2013 年 11 月 20 日
Hi Alex,
I'm running into the exact problem... were you able to find a solution since you posted?
Thomas

Thomas
Thomas 2013 年 11 月 26 日
Thanks for the reply Alex and Sean. I guess I'll patiently wait until this bug is solved.
Thomas

Jeffrey Chiou
Jeffrey Chiou 2014 年 6 月 25 日
編集済み: Jeffrey Chiou 2014 年 6 月 25 日
Hi Alex,
I found a workaround that involves editing the matlabrc.m file (which is generally discouraged). As a disclaimer, I haven't fully tested it, so there may be side effects.
  • Set permissions on matlabrc.m such that you can edit it. On windows I have the take ownership registry hack installed, so I just used that.
  • Edit matlabrc.m. Copy and paste this block of code to the end of the file and comment out the original as backup.
if ismcc || ~isdeployed
try
% Execute startup M-file, if it exists.
if (exist('startup','file') == 2) ||...
(exist('startup','file') == 6)
startup
end
catch exc
warning(message('MATLAB:matlabrc:Startup', exc.identifier, exc.message));
end
end
  • Change this line in the new code:
if ismcc || ~isdeployed
to this:
if ~(ismcc || isdeployed)
This makes sure startup.m is only executed when not in the compilation process. Now you should get your input display back!
  • Finally, since you are getting user input in your startup.m, parpool/matlabpool will hang. To work around that, you can add this piece of code in your startup.m or matlabrc.m:
if isempty( java.lang.System.getProperty('java.awt.headless') )
startup
else
disp('Parallel worker, not running startup.m');
end
This checks to make sure startup.m only runs when you can enter user input.
Edit: If it still doesn't work, try adding
while ismcc, end
or
if ~ismcc
in startup.m

カテゴリ

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