2D logical indexing of 1D array for resulting 2D array
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am trying to extract the values of a 1D cell array based on a 2D logical array. Something like this:
A = {'A';
'B';
'C'};
ind = logical([1, 1; 0 0; 0 1]);
B = {'A', 'A';
[], [];
[], 'C'};
Unfortunately it's not as simple as
B = A(ind)
but I can't think of a way to do it without a cumbersome loop.
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices 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!