How to select specific lines of a table, under a condition ?
Afficher commentaires plus anciens
Hello to everyone,
I have one problem regarding the selection of some specific lines of a table under a condition. I have a matrix(n,3) that contains numbers. What I want to do, is to select only the lines that its both three elements meet the requirement of being under a threshold (named d) and store them in a new matrix(m,3). It is about a solution convergence, so when the program identifies the first line as "true", then all the next lines should be stored in the new matrix, except for the fact that they do not meet the condition d. I have written the next code, but it's not working correctly I think.
for i=1:(size(table,1))
if (table(i,1) < d) && (constable(i,2) < d) && (constable(i,3) < d);
newtable(i,1) = constable(i,1);
newtable(i,2) = constable(i,2);
newtable(i,3) = constable(i,3);
end
end
Could someone please help me and tell me how exactly I have to do this ?
Thank you in advance
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!