I have a body data array read from a excel file: 9000-by-130. I also have the header line read from the same file: 1-by-130. I am trying to create a 900-by-130 dataset from the data array while using the elements of the header line array as variable names.
data = <9000x130 dataset>headers = <1x130 cell>
The issue I'm having is…
D = dataset(array(:));
…just creates a 9000-by-1 dateset!? So, for example,
for i = 1:size(headers,2) dataSet.Properties.VarNames{i} = headers{i};end
…cannot find variables to match elements in headers{i}.
The only solution is to enter the variables and the names manually 130 times!
dataSet = dataset(data(:,1),data(:,2)...data(:,130),'VarNames',{'Var1','Var2',...,'KillMeNow'});
Surely there's a simpler way. Is there?
Best Answer