MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
Set and Access Values of Custom Properties

When you add custom properties using addprop, their values are empty arrays by
default. You can set and access the values of the custom properties using dot syntax.

Set the output file name and type. These properties contain metadata for the table. Then
assign a logical array to the ToPlot property. This property contains metadata for the
variables. In this example, the elements of the value of the ToPlot property are true for
each variable to be included in a plot, and false for each variable to be excluded.

T.Properties.CustomProperties.OutputFileName = 'outageResults';
T.Properties.CustomProperties.OutputFileType = '.mat';
T.Properties.CustomProperties.ToPlot = [false false true true true false];
T.Properties

ans =
TableProperties with properties:

Description: ''
UserData: []
DimensionNames: {'Row' 'Variables'}
VariableNames: {1x6 cell}
VariableDescriptions: {}
VariableUnits: {}
VariableContinuity: []
RowNames: {}

Custom Properties (access using t.Properties.CustomProperties.<name>):
OutputFileName: 'outageResults'
OutputFileType: '.mat'
ToPlot: [0 0 1 1 1 0]

Plot variables from T in a stacked plot using the stackedplot function. To plot only the
Loss, Customers, and RestorationTime values, use the ToPlot custom property as
the second input argument.

stackedplot(T,T.Properties.CustomProperties.ToPlot);

9 Tables

Free download pdf