Example:
>> A = table({}, {}, {}, {}, {}, ...
'VariableNames', {'Foo', 'Bar', 'Baz', 'Frobozz', 'Quux'});
>> vn = A.Properties.VariableNames;
>> isequal(vn, A.Properties.VariableNames)
ans =
1
So far so good, but even if vnthey A.Properties.VariableNamesseem the same, they behave differently when you try to get a comma-separated list from them (using {:}):
>> {'Frobnitz', vn{:}}
ans =
'Frobnitz' 'Foo' 'Bar' 'Baz' 'Frobozz' 'Quux'
>> {'Frobnitz', A.Properties.VariableNames{:}}
ans =
'Frobnitz' 'Foo'
Is there a way to get a “comma delimited list” from A.Properties.VariableNames directly (i.e. without creating an intermediate variable such as vn)?
(In addition, is there a more reliable function than isequalfor checking the equality of cells in arrays? In the above example, vnthey are A.Properties.VariableNamesclearly not equal enough!)
, MATLAB, ( ) table, , dataset ( ). :
clear('A', 'vn');
A = dataset({}, {}, {}, {}, {}, ...
'VarNames', {'Foo', 'Bar', 'Baz', 'Frobozz', 'Quux'});
vn = A.Properties.VarNames;
isequal(vn, A.Properties.VarNames)
{'Frobnitz', vn{:}}
{'Frobnitz', A.Properties.VarNames{:}}
( VariableNames VarNames; : ):