필터 지우기
필터 지우기

convert a cell array which has cells inside it with matrices of different sizes to a big matrix

조회 수: 3 (최근 30일)
I have a cell array with size (1*100) containing cells that these cells have only numbers 0 and 1. The screenshot of the cell array is attached. Each cell inside the cell array contains a matrix with different sizes. I am not able to convert this cell to matrix because to use cell2mat all cells must be the same size and same class.
My aim is to convert this cell array(1*100) to a matrix.How can I do that?
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 6월 9일
What size of output are you expecting? Are you trying to convert the various entries into columns of the output? Are you trying to put all of the entries as one continuous column vector?
Stephen23
Stephen23 2019년 6월 10일
Sahar Pordeli Behrouz's "Answer" moved here:
Hi. Thanks for your reply. I need to try both of the ways you mentioned. I want to get one big vector containing only 1 and zero and then count numbers of zero and 1 for geting true positive and false positive. Also I want to run a loop over the cells and concatenate them one by one to an array. Thanks for your help.

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

채택된 답변

Walter Roberson
Walter Roberson 2019년 6월 10일
%one big vector
vertcat(YourCell{:})
Considering that you can do this without looping, is there a particular reason you want to add the parts on one by one?

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by