find and save the rows where condition is met
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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'.
0 commentaires
Réponse acceptée
David Hill
le 28 Jan 2021
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur File Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!