フィルターのクリア

Extract all columns for a single row in a cell array

4 ビュー (過去 30 日間)
Riccardo Rossi
Riccardo Rossi 2019 年 3 月 11 日
回答済み: KSSV 2019 年 3 月 11 日
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!

採用された回答

KSSV
KSSV 2019 年 3 月 11 日
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}),:)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by