I am trying to create an if/else staement over a range of values and display the corresponding value for each values variable. Ex if a<5 then c=2 b=1 else c=3 b=4 but over a range of a values displaying each c or b value for each of the a values
Show older comments
%I want to display each coa or cob value for each tp value of 0 through 1500 in 100 degree increments%
for tp=0:100:1500;
if tp<1600
coa=299180; cob=37.85; coc=-4571.9;
cooa=56835; coob=66.27; cooc=-11634;
hhoa=88923; hhob=49.36; hhoc=-7940.8;
ooa=43388; oob=42.27; ooc=-6635.4;
nna=31317; nnb=37.46; nnc=-4559.3;
else
coa=309070; cob=39.29; coc=-6201.9;
cooa=93048; coob=68.58; cooc=-16979;
hhoa=154670; hhob=60.43; hhoc=-19212;
ooa=127010; oob=46.25; ooc=-18798;
nna=44639; nnb=39.32; nnc=-6753.4;
end
Accepted Answer
More Answers (1)
Dimitris Kalogiros
on 21 Sep 2018
0 votes
Dear Bardon,
At the code you gave us, tp never exceeds 1500, so regarding the if-statement, always the first part of it is executed.
Regards
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!