get

Class: dataset

Access dataset array properties

The dataset data type might be removed in a future release. To work with heterogeneous data, use the MATLAB® table data type instead. See MATLAB table documentation for more information.

Syntax

get(A)
s = get(A)
p = get(A,PropertyName)
p = get(A,{PropertyName1,PropertyName2,...})

Description

get(A) displays a list of property/value pairs for the dataset array A.

s = get(A) returns the values in a scalar structure s with field names given by the properties.

p = get(A,PropertyName) returns the value of the property specified by the string PropertyName.

p = get(A,{PropertyName1,PropertyName2,...}) allows multiple property names to be specified and returns their values in a cell array.

Examples

Create a dataset array from Fisher's iris data and access the information.

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);

get(iris)
   Description: ''
   Units: {}
   DimNames: {'Observations' 'Variables'}
   UserData: []
   ObsNames: {150x1 cell}
   VarNames: {'species' 'SL' 'SW' 'PL' 'PW'}

ON = get(iris,'ObsNames');
ON(1:3)
ans = 
    'Obs1'
    'Obs2'
    'Obs3'

See Also

|

Was this topic helpful?