Separating an array based on row data?
4 ビュー (過去 30 日間)
古いコメントを表示
I have an array consisting of 3 columns and 'x' number of rows. Let's call it "Original_Data".
"Original_Data" contains rows where there are values of '0' and I wish to split my array into two new arrays:
- "Bad_data" will be an array consisting of the original 3 columns from "Original_Data" and all rows from "Original_Data" which contain values of '0'
- "Good_data" will be an array consisting of the original 3 columns from "Original_Data" and all rows from "Original_Data" which do not contain values of '0'
How would I do this?
0 件のコメント
回答 (1 件)
Jan
2022 年 3 月 15 日
Data = randi([0,3], 4, 3) % Some Test data
good = all(Data, 2); % No zeros in a row
goodData = Data(good, :)
badData = Data(~good, :)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Cell Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!