필터 지우기
필터 지우기

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 CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by