필터 지우기
필터 지우기

Arrange figures in numerical order...

조회 수: 15 (최근 30일)
David Pesetsky
David Pesetsky 2018년 7월 22일
댓글: Boxuan Zhao 2021년 1월 5일
There's a nice little function on the exchange that sorts figures on the screen, but it's not sorting in numerical order how the Figures are numbed: https://www.mathworks.com/matlabcentral/fileexchange/52774-arrangefigures-handles
This statement I believe...
figureHandles = sort(get(0, 'Children'));
...needs to truly sort in Figure numerical order. Then it would work.
Can it be improved?
Thanks!

채택된 답변

Walter Roberson
Walter Roberson 2018년 7월 22일
For HG2, it would be
figureHandles = handle( sort( double(findall(0, 'type', 'figure') ) );
This will find all figures, including the interface frames for apps; if you want only user created figures then change findall to findobj .
This code will sort according to numeric handle. Even in HG2, each graphics object is associated with a double, just like in HG1. And just like in HG1, the handles for figures are not necessarily integers. You cannot generally predict the range of double that will be associated with a figure that was not created with 'IntegerHandle', 'on' or by using figure(INTEGER) to create a figure with that particular integer handle.
  댓글 수: 2
David Pesetsky
David Pesetsky 2018년 7월 22일
findobj did the trick. Perfect. I'll try to make a shortcut to that function in the quick access toolbar.
Thanks again
Boxuan Zhao
Boxuan Zhao 2021년 1월 5일
Amazing solution, thank you Walter, I've been trying to figure this out for so long!!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by