필터 지우기
필터 지우기

Help with cell subsindex

조회 수: 2 (최근 30일)
FRANCISCO
FRANCISCO 2013년 12월 12일
댓글: FRANCISCO 2013년 12월 12일
I have a matrix of 350 rows and a column that contains the number of (-1) that contains a specific pattern. I have a cell of 95 rows and one column and in each row I indicates a row number. How I can insert the numbers in the array of 350 elements corresponding to the rows indicated in cell 95 rows?
For example, I have a matrix?
A = [41, 12, 23, 34];
and I have the cell:
r = {[1, 2, 3], [2, 4] [1, 4]}
And the result I want is:
r2={ [41;12;23];[12;34];[41;34] }
Many thanks

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 12월 12일
편집: Azzi Abdelmalek 2013년 12월 12일
A = [41, 12, 23, 34];
r = {[1, 2, 3], [2, 4] [1, 4]};
r2=cellfun(@(x) A(x),r,'un',0)
celldisp(r2)
  댓글 수: 1
FRANCISCO
FRANCISCO 2013년 12월 12일
Many thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by