フィルターのクリア

How to split data by classes?

1 回表示 (過去 30 日間)
z donyavi
z donyavi 2018 年 4 月 7 日
回答済み: KSSV 2018 年 4 月 7 日
I have a matrix with dimensions of 95 * 8. The data has three classes of 1,0 and -1. I want to give each class the data in a matrix named preclass (i),'i' is class name, and this is done with a 'for' loop.
  1 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 4 月 7 日
Question not Clear?

サインインしてコメントする。

採用された回答

KSSV
KSSV 2018 年 4 月 7 日
Let A be your data of size 95*8 and T be your classes 95*1 with three classes -1,0,1. To seperate the data:
preclass = cell(3,1) ;
class = [-1 0 1] ;
for i = 1:3
preclass{i} = A(T==class(i),:) ;
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by