selection from matrix with condition

4 visualizzazioni (ultimi 30 giorni)
Dam
Dam il 6 Dic 2012
Hi to all, actually i m having a matrix X=250*10 from which i want to choose the colomns that have an average >0.1 and a standard diviation >0.2 and put them in a new matrix 250*k ((where k depends on the colomns that satisfy the 2 (between 0 and 10)) Thank you in advance for your help with this
best regards

Risposta accettata

Image Analyst
Image Analyst il 6 Dic 2012
How about this:
stdX = std(X, 1)
meanX = mean(X, 1);
meetCriteria = meanX > 0.1 & stdX > 0.2
out = X(:, meetCriteria);
  2 Commenti
Image Analyst
Image Analyst il 6 Dic 2012
Hopefully this wasn't your homework!!!
Dam
Dam il 6 Dic 2012
Thank you for your answer it s not my homework i m learning matlab alone so this question could be very easy for you but for me it s not :) Thank you once more Dima

Accedi per commentare.

Più risposte (1)

Matt J
Matt J il 6 Dic 2012
X(:,std(X)<=.2 | mean(X)<=0.1)=[];
  2 Commenti
Dam
Dam il 6 Dic 2012
Thank you for your answer, the second answer works better
Best regards
Matt J
Matt J il 6 Dic 2012
Modificato: Matt J il 7 Dic 2012
I can't see how you would have gotten different results, be they better or worse.

Accedi per commentare.

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by