필터 지우기
필터 지우기

How to store different size matrices into single matrix?

조회 수: 51 (최근 30일)
Sameema Tariq
Sameema Tariq 2020년 12월 20일
댓글: Walter Roberson 2020년 12월 20일
I am working on R2017a. I have 1x102 cells . Each cell has another cell of different dimension. Here it is
I have convert it into a matrix form using the following code.
Here FBbag contains 1x102 cells.
But error arise at R(k,:)=c when I store these different dimension matrices into a matrix. because each matrix has varying number of dimension. So how do I store different sizes of matrix into single matrix.

답변 (1개)

Walter Roberson
Walter Roberson 2020년 12월 20일
  댓글 수: 2
Sameema Tariq
Sameema Tariq 2020년 12월 20일
Oh its again converted to a cell. Initially I have cells, I have converted these cells into a matrix, and stored these different dimension matrix to another matrix. So a new matrix has 102xn double dimension
Walter Roberson
Walter Roberson 2020년 12월 20일
The only way to store different sizes of information into a single matrix is if the matrix is a structured data type such as cell() or struct array. But you cannot do it with a numeric matrix.
One thing that people sometimes do with numeric matrices is to pad all of the blocks to be the same size so that they can store them in numeric form. It is common to pad with 0; it is also common to pad with nan -- padding with 0 makes the code easier, but runs the risk that you would be unable to tell a real 0 from a 0 that was there for padding purposes.

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

카테고리

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