matrix column element limiting
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
mehrdad asadi
am 8 Jul. 2015
Bearbeitet: Stephen23
am 8 Jul. 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 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 8 Jul. 2015
Example
A=rand(200,30)
idx=A(:,29)>0.5 & A(:,30)<0.7
out=A(idx,:)
4 Kommentare
Stephen23
am 8 Jul. 2015
Bearbeitet: Stephen23
am 8 Jul. 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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!