Using findjobj in R2013a

조회 수: 1(최근 30일)
Daniel Shub
Daniel Shub 2013년 9월 27일
댓글: Daniel Shub 2013년 10월 16일
I am trying to use Yair's FEX:findjobj in R2013a on Linux to basically do what he did in his blog post
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
jEditor = desktop.getGroupContainer('Editor').getTopLevelAncestor;
jEditor.findjobj
This causes MATLAB to become unresponsive and basically hang. I unfortunately don't have any other versions of MATLAB currently. Can anyone reproduce this?

채택된 답변

Daniel Shub
Daniel Shub 2013년 10월 16일
I did a little profiling and found the problem. The findobj function calls home to the FEX and checks for a newer version in the checkVersion subfunction. On my system this fails because urlread times out (which takes a long time). The checkVersion subfunction catches the error and then discards it, which makes it tough to figure out what is going on. Using the undocumented feature of findobj
addpref('FindJObj','dontCheckNewerVersion', true)
stops from calling home and avoids the problems. I wonder if an error on trying to check the newer version should automatically set the preference to not check for updates.

추가 답변(2개)

per isakson
per isakson 2013년 9월 27일
편집: per isakson 2013년 9월 27일
It seems to work fine here: R2013a, 64bit, Win7
>> desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
jEditor = desktop.getGroupContainer('Editor').getTopLevelAncestor;
jEditor.findjobj
ans =
handle: 1-by-1620
>> version
ans =
8.1.0.604 (R2013a)
and the GUI is responsive
  댓글 수: 1
Daniel Shub
Daniel Shub 2013년 9월 27일
Thanks. I wonder if it is Linux or my machine. Will have to keep searching.

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


Yair Altman
Yair Altman 2013년 10월 5일
You only need to use findjobj without an output (result assignment) value if you want to see an interactive GUI display of all the objects in your analyzed object (in this case Desktop). If your Desktop contains numerous panels/windows/docked figures etc., then there might be so many descendant objects that it would take a long time (and large amounts of memory) to process, which might explain what you see.
If you only need findjobj to get the underlying reference of something, then assign a result (e.g., something=findjobj(...); ) and this should solve the issue. If you want to see the interactive GUI, then consider reducing your Desktop's complexity by closing some panels, or maybe start Matlab when it has access to more physical memory (to prevent virtual memory usage and thrashing).
  댓글 수: 3
Daniel Shub
Daniel Shub 2013년 10월 16일
The hang happens in checkVersion. See my answer.

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

범주

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by