finding cell array elements

1 回表示 (過去 30 日間)
Tha saliem
Tha saliem 2017 年 4 月 11 日
コメント済み: Tha saliem 2017 年 4 月 11 日
hi. I have a cell array containing many values like this:
x{2x1 cell;3x1 cell}
and each cell contains value like this:
x{1,1}={4;4}
x{2,1}={4;[1;4];[1;3]}
y=[0,0,1,-1,0,0; 1,0,-1,1,0,0] %2D array
I want to search elements of x one by one in corresponding row of y.
Thanks in advance

採用された回答

Guillaume
Guillaume 2017 年 4 月 11 日
This would do it:
result = arrayfun(@(row) cellfun(@(columns) y(row, columns), x{row}, 'UniformOutput', false), ...
(1:size(x, 1)).', 'UniformOutput', false);
  1 件のコメント
Tha saliem
Tha saliem 2017 年 4 月 11 日
Thanks alot. this is so accurate

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by