Azzera filtri
Azzera filtri

Extract all columns for a single row in a cell array

4 visualizzazioni (ultimi 30 giorni)
Hi everybody,
i have two cell array like the following:
A {1,1}
1
0
0
0
B {1,1}
12 34 54
11 31 51
26 44 94
15 54 58
I want to extract all the columns for single row in B based on A, like the following example:
C{1,1}
12 34 54
I made this script but it extracts only the first column value (in this case 12):
A {1,n}
B {1,n}
for k=1:n
C{k}=B{1,k,:,:}(A{1,k,:,:});
end
How can i do it?
Thank you a lot!

Risposta accettata

KSSV
KSSV il 11 Mar 2019
A {1,1} = [1
0
0
0] ;
B {1,1} = [12 34 54
11 31 51
26 44 94
15 54 58 ];
B{1,1}(logical(A{1,1}),:)

Più risposte (0)

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by