matrix column element limiting
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
mehrdad asadi
le 8 Juil 2015
Modifié(e) : Stephen23
le 8 Juil 2015
hi,
I have a matrix say 200*30. I need to limit the elements of 29th and 30th columns with different constraints. how can I do that?
thanks,
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 8 Juil 2015
Example
A=rand(200,30)
idx=A(:,29)>0.5 & A(:,30)<0.7
out=A(idx,:)
4 commentaires
Stephen23
le 8 Juil 2015
Modifié(e) : Stephen23
le 8 Juil 2015
Azzi Abdelmalek's solution is much more optimized than using a loop. This is how MATLAB works best, using basic code vectorization and indexing.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with Optimization Toolbox 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!