How can we create DATASET in MATLAB?
81 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Machine Learning Enthusiast
el 26 de Sept. de 2016
Comentada: Walter Roberson
el 7 de Jul. de 2021
I want to create DATASET for Nuts and Bolts by below code but i gets an error.Can anyone helps me?
% Create a standard MATLAB dataset from data and labels.
dat =[ 0.1 0.9 ; 0.3 0.95 ; 0.2 0.7 ];
lab ={ 'class 1', 'class 2', 'class 3' };
z =dataset(dat,lab);
[nlab,lablist] = getNlab(z); % Extract the numeric labels
[m,k,c]=getsize(z); % Extract number of classes
for i= 1:c
T{i}=seldat(z,i);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156614/image.png)
end;
Respuestas (1)
Walter Roberson
el 26 de Sept. de 2016
You have two columns and three variable names.
Perhaps the rows in your data are variables. If that is the case then
dataset(dat .', lab)
2 comentarios
Walter Roberson
el 26 de Sept. de 2016
If you are looking for one variable per row then,
z = dataset({dat.',lab{:}});
If you want the columns to be the variables then you have too many column names.
lab2 = lab(1:2);
z = dataset({dat, lab2{:}});
Ver también
Categorías
Más información sobre Pattern Recognition and Classification en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!