Why am I not able to generate new struct in my for loop?

1 Ansicht (letzte 30 Tage)
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 2 Okt. 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

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by