Modifying property display order

I know I can use matlab.mixin.CustomDisplay inheritance (https://mathworks.com/help/matlab/ref/matlab.mixin.customdisplay-class.html) in connection with a getPropertyGroups method (https://mathworks.com/help/matlab/matlab_oop/use-cases.html) to modify the order in which object properties are displayed in the workspace.
In my case, I have objects with many properties. I want some of them (e. g. ID) to be displayed "on top". The rest I don't care about (though it would be nice to sort them in alphabetical order). I have two questions:
  1. Is there a way to achieve that feat without having to manually create a lengthy sorted proplist with all property names?
  2. Is there a way to display only the first n properties and show the rest only when clicking on a "show all" button (like e. g. with the built in figure class)?

3 件のコメント

per isakson
per isakson 2023 年 3 月 12 日
Maybe it's simpler to make a separate function, which uses
mcls = meta.class.fromName( 'your_class_name' );
list = mcls.PropertyList;
sort( list )
move ID to top of list
broken_arrow
broken_arrow 2023 年 3 月 15 日
I tried, but that only seems to return the property names of the meta class 'class' (like Dependent, Constant etc.) which is not what I need. Am I missing something?
per isakson
per isakson 2023 年 3 月 19 日
No it's me that's missing something!

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

リリース

R2022b

タグ

質問済み:

2023 年 3 月 12 日

コメント済み:

2023 年 3 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by