Why am I not able to generate new struct in my for loop?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Robert Flores
le 2 Oct 2019
Réponse apportée : Walter Roberson
le 2 Oct 2019
Hello,
I am trying to make a new struct in my varible SBOB, such that it contains relative velocities. I have some structs already contained in the varible assignment SBOB, such as the velocities I want to take the differences of. I do not know why the script is not working, I used this same for loop to gerenate those velocities I am trying to take the diffeerences from. Below is a copy of my code so far, if anyone can help me resolve this issue, it will be greatly appreciated.
Sincerely,
Robert
CODE:
for p = 1:length(SBOB)
for r = 1:3 % This is not for all channels, just bridge & tower parts
for h = [8 9 10]
for w = [11 12 13]
for c = [14 15 16]
SBOB{p}.rel_disp_LW(:,r) = SBOB{p}.disp(:,w) - SBOB.disp(:,h)
SBOB{p}.rel_disp_SW(:,r) = SBOB{p}.disp(:,c) - SBOB.disp(:,h)
end
end
end
end
end
0 commentaires
Réponse acceptée
Walter Roberson
le 2 Oct 2019
for p = 1:length(SBOB)
for r = 1:3 % This is not for all channels, just bridge & tower parts
for h = [8 9 10]
for w = [11 12 13]
SBOB(p).rel_disp_LW(:,r) = SBOB(p).disp(:,w) - SBOB(p).disp(:,h);
for c = [14 15 16]
SBOB(p).rel_disp_SW(:,r) = SBOB(p).disp(:,c) - SBOB(p).disp(:,h);
end
end
end
end
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!