自定义类的对象显示
自定义 MATLAB® 如何在命令行窗口中显示类的对象
CustomDisplay
类定义了一个接口,可以用它来自定义 MATLAB 如何显示对象。有关该接口的综述,请参阅Custom Display Interface。此外,您可以通过 CustomCompactDisplayProvider
类来自定义容器(如结构体和表)中对象的显示。有关该接口的综述,请参阅Custom Compact Display Interface。
函数
details | 显示数组详细信息 |
类
matlab.mixin.CustomDisplay | 用于自定义对象显示的接口 |
matlab.mixin.util.PropertyGroup | 用于对象显示的自定义属性列表 |
matlab.mixin.CustomCompactDisplayProvider | Interface for customizing object display within containers |
matlab.display.CompactDisplayRepresentation | Base class for representing compact display of object array |
matlab.display.DisplayConfiguration | Describe display environment and settings |
matlab.display.DimensionsAndClassNameRepresentation | Compact display representation using dimensions and class name |
matlab.display.PlainTextRepresentation | Compact display representation using data in object array |
主题
自定义显示接口类和方法
- Custom Display Interface
TheCustomDisplay
class provides an API for customizing the display of objects of your class. - How CustomDisplay Works
MATLAB determines the state of an object and then calls specific methods for that state to display the object. - Class with Default Object Display
This example class customizes various aspects of object display. - Role of size Function in Custom Displays
MATLAB uses the size function to help determine the state of the object to display.
用于自定义对象显示的特定方法
- Choose a Technique for Display Customization
You can customize object display based on the state of the object and you can change different parts of the display. - Customize Property Display
Change the order and number of properties displayed for an object of your class. - Customize Header, Property List, and Footer
Customize each of the three parts of the display — header, property groups, and footer. - Customize Display of Scalar Objects
Customize the display of scalar objects. - Customize Display of Object Arrays
Customize the display of nonscalar objects, including empty object arrays. - Customize Display for Heterogeneous Arrays
You can call only sealed methods on nonscalar heterogeneous arrays. - Overloading the disp Function
Overloading thedisp
function provides limited display customization.
自定义紧凑显示
- Custom Compact Display Interface
Customize the representation of objects in compact display scenarios.