필터 지우기
필터 지우기

How can we create DATASET in MATLAB?

조회 수: 81 (최근 30일)
Machine Learning Enthusiast
Machine Learning Enthusiast 2016년 9월 26일
댓글: Walter Roberson 2021년 7월 7일
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);
end;
  댓글 수: 2
hemasai proddutur
hemasai proddutur 2021년 7월 6일
getNlab is showing error
Walter Roberson
Walter Roberson 2021년 7월 7일
It looks to me as if possibly getnlab is from http://www.37steps.com/prhtml/prtools.html

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 9월 26일
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
Machine Learning Enthusiast
Machine Learning Enthusiast 2016년 9월 26일
it gives below error
>> Untitled Error using dataset (line 279) Must have one variable name for each column when creating multiple variables from an array.
Error in Untitled (line 6)
z =dataset(dat .', lab);
Walter Roberson
Walter Roberson 2016년 9월 26일
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{:}});

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Pattern Recognition and Classification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by