Dear Community,
I am facing a problem with a cell array dimension. After obtaining it with a for loop the dimension of it is 88x88 containing 6x6 matrix inside each variable. What I want to do is to change it to 176x176 cell array containing a 3x3 matrix as a variable. This is where I am currently stucked at:
Gesamtsystem_Kugel = cell(88,88);
for ki = 1:88
for ji = 1:88
if ki == ji
Gesamtsystem_Kugel{ki,ji} = Ubertragungsmatrix_sp{ki,:};
elseif ki == ji-1
Gesamtsystem_Kugel{ki,ki+1} = -Einheitsmatrix;
else
Gesamtsystem_Kugel{ki,ji} = Matrix_0;
end
end
end
New_Gesamtsystem_Kugel = reshape(Gesamtsystem_Kugel,[],[176,176]);
But Unfortunately its not working. I'm getting "Error using reshape
Size arguments must be integer scalars."
Could you please help me?

답변 (1개)

Walter Roberson
Walter Roberson 2020년 9월 16일

1 개 추천

reshape() is not able to do anything close to that. It can never repackage the data into other containers. All that reshape can do is change the numbering used to represent memory, such as re-arranging
1
2
3
4
to
1 3
2 4
What you need is something like
New_Gesamtsystem_Kugel = mat2cell(cell2mat(Gesamtsystem_Kugel), 3 * ones(1,176), 3 * ones(1,176));

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2020a

태그

질문:

2020년 9월 16일

댓글:

2020년 9월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by