Effacer les filtres
Effacer les filtres

Reshape Cell array dimensions

5 vues (au cours des 30 derniers jours)
Marcelo Boldt
Marcelo Boldt le 16 Sep 2020
Commenté : Marcelo Boldt le 16 Sep 2020
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?

Réponses (1)

Walter Roberson
Walter Roberson le 16 Sep 2020
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 commentaire
Marcelo Boldt
Marcelo Boldt le 16 Sep 2020
It Works!! Thank you !

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by