How can I make a dataset array of my matrix data and labels in Statistics Toolbox 7.6 (R2011b)?

1 view (last 30 days)
I have a set of labels and a matrix. How can I put them into a dataset array, with the labels becoming the headings for each column of the dataset array?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 8 Nov 2012
Go through the documentation of the DATASET command in Release 2012b (R2012b) for more details. For previous releases, read below for any additional information:
If your labels and data are as follows:
myLabels = {'my_label_1' 'my_label_2' 'my_label_3'}
myData = reshape(1:15, 5, 3)
You can use the following command to make a dataset array whose columns contain the data from your matrix, and whose column headers are drawn from your cell of labels:
ds = dataset({myData(:,:) myLabels{:}})

More Answers (0)

Products


Release

R2011b

Community Treasure Hunt

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

Start Hunting!