Merging Smaller Cells into a Bigger one
Mostrar comentarios más antiguos
Dear Community,
I am currently facing one problem:
I have two cell arrays, one cell is (98,2) and the other the other is (128,2), each variable consists of a 3x3 matrix and I want to insert this packages of information in the diagonal of a cell array of (226,226). For that I've prepared the following loops:
K_reinforcement = cell(98,2);
for iik=1:2:97
K_reinforcement{iik,1} = - pinv(New_Gesamtsystem_reinforcement{iik,2}) * New_Gesamtsystem_reinforcement{iik,1};
K_reinforcement{iik,2} = pinv(New_Gesamtsystem_reinforcement{iik,2});
end
for iik=2:2:98
K_reinforcement{iik,1} = transpose(pinv(New_Gesamtsystem_reinforcement{iik-1,2}));
K_reinforcement{iik,2} = (New_Gesamtsystem_reinforcement{iik,2}) * pinv(New_Gesamtsystem_reinforcement{iik-1,2});
end
Displacement_Total_System = cell(226,226);
for mkm = 1:2:97
for mkn = 1:2:97
Displacement_Total_System{mkm,mkm} = K_tank_reinforcement{mkm,1};
Displacement_Total_System{mkm,mkm+1} = K_tank_reinforcement{mkm,2};
end
end
for mkm = 2:2:98
for mkn = 2:2:98
Displacement_Total_System{mkm,mkm} = K_tank_reinforcement{mkm,1};
Displacement_Total_System{mkm,mkm+1} = K_tank_reinforcement{mkm,2};
end
end
for mkm = 97:2:225
for mkn = 97:2:225
Displacement_Total_System{mkm,mkm} = K_spherical_dome{mkm,1};
Displacement_Total_System{mkm,mkm+1} = K_spherical_dome{mkm,2};
end
end
for mkm = 98:2:226
for mkn = 98:2:226
Displacement_Total_System{mkm,mkm} = K_spherical_dome{mkm,1};
Displacement_Total_System{mkm,mkm+1} = K_spherical_dome{mkm,2};
end
end
Unfortunately, I get the following error: Index in position 1 exceeds array bounds (must not exceed 128).
Do you have any solution or recommendation to this problem?
Thank you!
2 comentarios
David Hill
el 21 de Sept. de 2020
Is your data all of the same type (double)?
Marcelo Boldt
el 21 de Sept. de 2020
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!