Evaluate first column data, set remaining columns to zero based on first column value.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Andrew Paulsen
il 26 Apr 2017
Commentato: Andrew Paulsen
il 26 Apr 2017
I have a matrix of data, several rows, 4 columns and I want to look at the first column value and if it is above or below a certain value, set all the remaining columns in that row to zero. Sounds simple, but struggling to figure it out.
0 Commenti
Risposta accettata
Walter Roberson
il 26 Apr 2017
mask = YourMatrix(:,1) > TheHighCutoff | YourMatrix(:,1) < TheLowCutoff;
YourMatrix(mask,2:end) = 0;
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Get Started with MATLAB in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!