Update field value in structures?
Afficher commentaires plus anciens
Hi.
I have structure L with field L0. L0 has two fields:H0 and H1.
H0=struct('h',[0,0],'Q_centroids',[-5,0,5,0],'Q_actions',[15,7,10],'Q_table',[0]);
H1=struct('h',[0,2],'Q_centroids',[1,0,pi/2,0],'Q_actions',[2,7,8],'Q_table',[2]);
L0=struct('H0',H0,'H1',H1);
L=struct('L0',L0);
relevant_L=L.L0;
relevant_L.H0.Q_centroids=[-pi/2,0,pi/2,0;1 5 4 2];
I want to update H0 and then save it in L. so i load L0(relevant_L=L.L0) then update it through the last line but new strcture is created(name:relevant_L).
i know we can do this by:
L.L0.H0.Q_centrids
but i want to change Q_centroids first by load L.L0 in another variable(relevant_L) and then change it.
Is it possible?
Thanks.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Structures dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!