필터 지우기
필터 지우기

Extract data from cell array

조회 수: 390 (최근 30일)
Bruno
Bruno 2014년 1월 30일
댓글: Moussa Bendjedia 2023년 1월 27일
I have a Y array (46x1 cell). I want extract four cells (3,4,5 and 9). Each cell is composed 1x728. How I can extract the data from the cells. Thanks

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 1월 30일
편집: Azzi Abdelmalek 2014년 1월 30일
Look at this example
y={rand(1,3) rand(1,3) rand(1,3) rand(1,3) rand(1,3)}
y([2 3])
You can have
cell2mat(y([2 3]))
or
cell2mat(y([2 3])')
For your case:
y([3 4 5 9])
  댓글 수: 4
Ted
Ted 2019년 10월 30일
If each cell contains a 2D matrix and the size of matrices are different, is there an easy way to re-format the values in the cell array into a 1D mat-array?
I guess the hard way will be to reshape the matrix within each cell into a 1D array and then, do cell2mat to concatenate them together.
I am wondering whether there is an easier way to do?
Moussa Bendjedia
Moussa Bendjedia 2023년 1월 27일
Merci Mr Azzi Abdelmalek from Moussa of Sétif

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by