find and save the rows where condition is met

2 ビュー (過去 30 日間)
C.G.
C.G. 2021 年 1 月 28 日
コメント済み: C.G. 2021 年 1 月 29 日
I have a 1x3001 cell, 'y', and I want matlab to loop through all the cells and save all the rows where the value in column 2 is <-0.13.
I have the following code but i get the error below. Please could somebody help me fix this?
%for all the csv files (3001)
for b = 1:length(data)
%get the ID number (:,1) and coordinates (:,6) and save them in an array
y{b} = table2array(data{b}(:,[1 6]));
%find and save all the rows in each csv file where column 2 is <-0.13
g{b} = y{b}(y(:,2) <= -0.13, :);
end
Undefined operator '<=' for input arguments of type 'cell'.

採用された回答

David Hill
David Hill 2021 年 1 月 28 日
for b = 1:length(data)
%get the ID number (:,1) and coordinates (:,6) and save them in an array
y{b} = table2array(data{b}(:,[1 6]));
%find and save all the rows in each csv file where column 2 is <-0.13
g{b} = y{b}(y{b}(:,2) <= -0.13, :);
end
  1 件のコメント
C.G.
C.G. 2021 年 1 月 29 日
thank you!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by