How to find corresponding indices?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Good Day,
I have a dataset I am working (891 rows,12 columns) with and have already sorted one column with zeros and ones (Logical). I would now like to pull data from 2 other columns (number and text) where the ones are located (neglecting the zeros). How can I write this in matlab?
TIA!
0 Commenti
Risposte (1)
Voss
il 9 Nov 2022
% some data
data = [0 10]+(1:10).'
% whether to get each row:
rows_to_get = [false; false; true; true; false; false; false; true; true; false]
% final result:
result = data(rows_to_get,:)
0 Commenti
Vedere anche
Categorie
Scopri di più su Logical 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!