Close (all) Variable Editor windows?

57 ビュー (過去 30 日間)
jkr
jkr 2017 年 6 月 20 日
コメント済み: Sanjeev Chaubey 2022 年 4 月 22 日
During development I often open many figures (plotting variables of interest) and many Variable Editor windows, often digging several layers deep into structs, generating lots of Variable Editor windows. When I am ready to move on to some next step, I can easily close all the figures with 'close all'. But I cannot find a way to close all the Variable Editor windows (so typically, I close each, of many, by clicking on the red dot (in OSX)). Not impossible, but tedious. There seems to be no complement to openvar. Am I missing something?

採用された回答

Jan
Jan 2017 年 6 月 20 日
編集済み: Jan 2017 年 6 月 20 日
This closes all docked and undocked ArrayEditors:
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
Titles = desktop.getClientTitles;
for k = 1:numel(Titles)
Client = desktop.getClient(Titles(k));
if ~isempty(Client) & ...
strcmp(char(Client.getClass.getName), 'com.mathworks.mde.array.ArrayEditor')
Client.close();
end
end
This is inspired by the link posted by Image Analyst.
  5 件のコメント
Michele Magni
Michele Magni 2021 年 12 月 8 日
Beautiful.
Sanjeev Chaubey
Sanjeev Chaubey 2022 年 4 月 22 日
too smart, you are awesome !

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2017 年 6 月 20 日
  2 件のコメント
jkr
jkr 2017 年 6 月 20 日
I didn't see how this helps. It addresses a different problem.
On the other hand, I've found something simple that works for me. Simply dock the Variable Editor. It is then easy to open bunches of variables, and close them all at once, by closing the Variable Editor tab. I had been opening each variable, individually, undocked. I can still undock a variable for particularly close inspection. I have to close such a window separately, but all the parents I had to wade through to reach the data of interest remain docked, and easily closed with a click.
Image Analyst
Image Analyst 2017 年 6 月 21 日
It was not intended to be a complete solution, though I can see how you might have thought so. It was intended to be a lead to figure out how you can do it. Fortunately, Jan got the hint and figured it out for you. I knew there was nothing in base MATLAB to do what you wanted and that it had to be an undocumented thing. For these kinds of special, tricky things, we always go to Yair Altman's undocumented MATLAB site. If Yair doesn't know how to do it, then it just can't be done.
You can also "Vote" for Jan's answer to give him more reputation points (like I've done).

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

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by