Replacing Matlab title name with process Id does not work with startup.m -


i want start matlab , replace title of matlab window process id. created following startup.m file:

cd e:\matlab_files\ jdesktop = com.mathworks.mde.desk.mldesktop.getinstance; jdesktop.getmainframe.settitle(['pid:' num2str(feature('getpid'))]); 

now, matlab changes folder e:\matlab_files process id not replaced. once matlab has started , execute 2nd , 3rd line of startup.m, title of matlab window replaced process id.

please explain cause of behaviour.

i using matlab 2009b.

all of graphics haven't finished initialising -> not able replace title (i assume hasn't yet been created).

you can check trying disp jdesktop.getmainframe.gettitle startup.m , see that empty.

thats explanation why - haven't asked fix - assume want one!! ;)

you can fix using timer - note put 60 seconds in timer below - lot less.

function startup   if ~isdeployed  % agood practice use incase ever compile codes.     cd e:\matlab_files\     timerfcn = @updatetitle;     tfcn = timer('startdelay', 60, 'timerfcn', timerfcn );     start(tfcn)   end end function updatetitle(varargin)   jdesktop = com.mathworks.mde.desk.mldesktop.getinstance;   jdesktop.getmainframe.settitle(['pid:' num2str(feature('getpid'))]); end 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -