cell array to dataset: the use of cell2dataset

1 次查看(过去 30 天)
I am trying to make a dataset that I can grow over time using the following code:
ds = [fileName,IntegralRange]
biopsy = cell2dataset(ds);
where ds will append two cell arrays and row 1 of each column will become the Variable name in the dataset. However this error keeps being thrown out and I have no idea how to fix it:
Error using dataset/subsref (line 396) Not valid dataset object field.
Error in cell2dataset>dfltDatasetVarNames (line 192) names = dummy.Properties.VarNames;
Error in cell2dataset (line 179) d = dataset(cell2struct(vars,dfltDatasetVarNames(nvars),2));
Error in IntegrateNew (line 66) biopsy = cell2dataset(ds);

回答(1 个)

Tom Lane
Tom Lane 2013-1-24
I can't tell what ds is when it gets passed into cell2dataset. This, for example, works:
>> ds = [{'name1';1;2;3}, {'name2';10;20;30}];
>> cell2dataset(ds)
ans =
name1 name2
1 10
2 20
3 30
Can you provide a simple example that's similar to yours but that fails?

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by