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

1 回表示 (過去 30 日間)
Robert  Flores
Robert Flores 2019 年 10 月 2 日
回答済み: Walter Roberson 2019 年 10 月 2 日
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

採用された回答

Walter Roberson
Walter Roberson 2019 年 10 月 2 日
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 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by