store the reshaped matrix from the nested cell array

조회 수: 13 (최근 30일)
Mathews Jabaraj Soloman
Mathews Jabaraj Soloman 2020년 4월 15일
댓글: Mathews Jabaraj Soloman 2020년 4월 15일
I want to read an matrix data from the nested cell array ( cell in cell struct.), whose size is 1*1000 and within each cell it contain 1*20 cell and within that 10*10 matrix.
Each of these matrix has to be accessed and reshaped to 1*100 vector and the resulting row vector has to be stored in a Matrix.
s=zeros(10190,400);
[n,m]=size(s);
for i=1:1019
for j=1:10
s(n,:)=reshape(Nested_Cell_array{1,i}{1,j},[1,100]);
end
end
I have used the above code to access each of the matrix and converted it as a row vector.
But I didn't know how to store each of those vector in a Matrix?
Because the size of the loop will exceed the the new Matrix formed.
Kindly let me know some suggestion.
Thank you.

채택된 답변

David Hill
David Hill 2020년 4월 15일
s=zeros(10190,100);
for i=1:1019
for j=1:10
s(10*(i-1)+j,:)=reshape(Nested_Cell_array{1,i}{1,j},[1,100]);
end
end

추가 답변 (1개)

KSSV
KSSV 2020년 4월 15일
matrix A 10*10 can be converted to array 1*100 using A(:)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by