How can I label a data set?

9 ビュー (過去 30 日間)
Siddhant Choudhary
Siddhant Choudhary 2018 年 10 月 28 日
回答済み: Image Analyst 2018 年 10 月 28 日
I am preparing some data for the classifier app in MATLAB and want to label my data i.e. I want to add a single column containing 8006 zeroes followed by 3400 ones, 2300 twos, 627 threes, 672 fours and 1006 fives. I have a .mat file for my data.

回答 (1 件)

Image Analyst
Image Analyst 2018 年 10 月 28 日
You can make a column vector like this
numRows = [8006,3400,2300,627,672,1006]
col = [];
for k = 1 : length(numRows)
col = [col; (k-1)*ones(numRows(k), 1)];
end

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by