storing a matrix using new variables established by 'eval'
Mostra commenti meno recenti
I am trying to get a for loop introduce a new variable for every loop using the 'eval' function and store a matrix in the new variable.
elements = 3;
nodes = 2;
phi = [pi / 3,pi-pi/3,0];
for i = 1:elements
eval(['stiffness_' num2str(i) '=zeros(2)'])
eval(['stiffness_' num2str(i) '=[(cos(phi(i)))^2,sin(phi(i)) * cos(phi);sin(phi(i)) * cos(phi(i)),(sin(phi(i)))^2]'])
end
but it's not working. Anyone out there know how to do this?
Risposta accettata
Più risposte (1)
Categorie
Scopri di più su MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!