MATLAB Answers

startup.m problem

13 views (last 30 days)
Oliver
Oliver on 4 Aug 2011
Edited: Jeffrey Chiou on 25 Jun 2014
In my startup.m file I install a toolbox each time matlab is loaded (because I store the toolbox in my Dropbox folder since I frequently change files in it and want access to the updated version from both computers that I use, however, if someone has a better idea I would love a more elegant solution). Here is the startup.m code:
addpath(genpath('C:\Users\Oliver\Dropbox\MATLAB'))
cd('C:\Users\Oliver\Dropbox\MIT\Jan2011 to Sep2011\Matlab Files')
%---install mtex toolbox---%
cd('C:\Users\Oliver\Dropbox\mtex-3.1')
startup_mtex;
%---change back to original directory---%
cd('C:\Users\Oliver\Dropbox\MIT\Jan2011 to Sep2011\Matlab Files')
With Matlab R2010b when Matlab started I would get the following message:
--------------------------------------------------------------------------------
MTEX is currently not installed.
Do you want to permanently install MTEX? Y/N [Y]
I would then type "y" and the toolbox would be installed. However, when I upgraded to R2011a I have a problem. When matlab starts I just get a blinking cursor and in the lower left hand corner the status says "waiting for input". If I type "y" then the message pops up and it installs alright. But why would Matlab switch the order of displaying the prompt and waiting for its input?
Incidentally, the first two times I opened Matlab after upgrading the prompt came up first and then it waited for my input, but after the first two times it switched and has stayed this way. Any ideas?
Thank you!
-Oliver

  0 Comments

Sign in to comment.

Answers (2)

Oliver Woodford
Oliver Woodford on 10 Aug 2011
Since you call startup_mtex from your startup file it adds mtex to the MATLAB path on startup. You therefore don't need to add it to the saved path, and can simply comment out line 27 of startup_mtex.m:
install_mtex(local_path);
thus getting rid of the issue. Incidentally, I prefer to add things to the path in my startup file (as you are doing) rather than add them to the permanent path because when I upgrade MATLAB I don't need to add them to the saved path all over again.

  2 Comments

Alex
Alex on 7 Nov 2013
Unfortunately I have the same problem and can not use suggested solution
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 (some) earlier versions of Matlab, but 2013a and 2013b just sits on blinking cursor. you have to guess and type something -- then it goes further.
Does anybody know how to deal with this annoying issue?
Samuel Quemby
Samuel Quemby on 1 Apr 2014
Hi,
I'm having (almost exactly) the same problem as Alex, above. Did you manage to find a solution?
Sam.

Sign in to comment.


Jeffrey Chiou
Jeffrey Chiou on 25 Jun 2014
Edited: Jeffrey Chiou on 25 Jun 2014
Hi Oliver,
In a nutshell, edit this line in the block that calls startup in matlabrc.m:
if ismcc || ~isdeployed
to this:
if ~(ismcc || isdeployed)
Edit: If it still doesn't work, try adding
while ismcc, end
or
if ~ismcc
in startup.m

  0 Comments

Sign in to comment.

Sign in to answer this question.

Products