i just need to know how can i extract the columns based on a condition

3 vues (au cours des 30 derniers jours)
omar mahallawy
omar mahallawy le 24 Fév 2019
Commenté : Andi le 31 Mar 2022
Capture.PNG
the condition is (if the first value in the column is less than or equal to a certain number then extract the whole column)
10 by 13 vector, in a for loop

Réponse acceptée

Walter Roberson
Walter Roberson le 24 Fév 2019
mask = TheArray(:,1) <= ACertainNumber;
output = TheArray(mask, :);
  4 commentaires
omar mahallawy
omar mahallawy le 25 Fév 2019
Thank you so much, it worked!
Andi
Andi le 31 Mar 2022
@Walter Roberson I highly appreciate your approch. I have a similar problem only the difference is in my case ACertainNumber is in a range e.g., 1-2 and then 2-3 and so on. Additionally, I need to compute the mean of ACertainNumber of all the selected coloumns. May you suggest any possible wayout.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by