Reshape Cell array dimensions

3 ビュー (過去 30 日間)
Marcelo Boldt
Marcelo Boldt 2020 年 9 月 16 日
コメント済み: Marcelo Boldt 2020 年 9 月 16 日
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 日
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));
  1 件のコメント
Marcelo Boldt
Marcelo Boldt 2020 年 9 月 16 日
It Works!! Thank you !

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by