Reshape Cell array dimensions
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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?
0 comentarios
Respuestas (1)
Walter Roberson
el 16 de Sept. de 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));
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!