Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

I need the results as matrices but in loop please see following

1 Ansicht (letzte 30 Tage)
Venkata Rama Krishna Gona
Venkata Rama Krishna Gona am 24 Aug. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
i=1;
n=2;
for i=1:n
G= zeros(n,n);
G = Angular_vel(i,i)*Angular_vel(i,i)*I;
end
here G value is getting overrided for second time and G is matrix. i need 'n' number of matrices as result. please help
  2 Kommentare
John D'Errico
John D'Errico am 24 Aug. 2020
No. You don't need n number of matrices. Just learn to use 3-d arrays. Or just learn to use cell arrays. Your problem is not what you think you need, but that you don't know how to use the tools available.
Create a matrix of size nxnxn. That is effectively n arrays, each of size nxn. You can access any one of them simply and use it as you wish.

Antworten (1)

Steven Lord
Steven Lord am 24 Aug. 2020
Bearbeitet: Steven Lord am 24 Aug. 2020
Can you define variables with numbered names like X1, X2, X3, ... ? Yes.

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by