set
(Not Recommended) Set and display dataset array properties
The dataset
data type is not recommended. To work with heterogeneous data,
use the MATLAB®
table
data type instead. See MATLAB
table
documentation for more information.
Syntax
set(A)
set(A,PropertyName
)
A = set(A,PropertyName
,PropertyValue
,...)
B = set(A,PropertyName
,value)
Description
set(A)
displays all properties of the dataset
array A
and their possible values.
set(A,
displays possible values for the property specified by
PropertyName
)PropertyName
.
A = set(A,
sets property name/value pairs.PropertyName
,PropertyValue
,...)
B = set(A,
returns a
dataset array PropertyName
,value)B
that is a copy of A
, but with the
property 'PropertyName'
set to the value value
.
Note
Using set(A,'PropertyName',value)
without assigning to a variable
does not modify A's properties. Use A = set(A,'PropertyName',value)
to modify A
.
Examples
Create a dataset array from Fisher's iris data and add a description:
load fisheriris NumObs = size(meas,1); NameObs = strcat({'Obs'},num2str((1:NumObs)','%-d')); iris = dataset({nominal(species),'species'},... {meas,'SL','SW','PL','PW'},... 'ObsNames',NameObs); iris = set(iris,'Description','Fisher''s Iris Data'); get(iris) Description: 'Fisher's Iris Data' Units: {} DimNames: {'Observations' 'Variables'} UserData: [] ObsNames: {150x1 cell} VarNames: {'species' 'SL' 'SW' 'PL' 'PW'}