What is wrong with my if statement?

1 回表示 (過去 30 日間)
Anon
Anon 2021 年 1 月 8 日
コメント済み: Anon 2021 年 1 月 8 日
Hello all,
I'm not sure how to phrase my if statement so that when the value of y at the point where x is equal to dto, the statement will run.
Currently it stops at the beginning of the if statement so i know that thats where the problem lies.
Below is my code for the relevant parts:
if max(x)>=Ox %&& (y(x==max(x))<=Oy)
dto = find(x < Ox,1,'last')
tto = dto/v0x
if y(x==dto)<=Oy %%this is where it stops
xlim([0, Ox+Ot+0.5])
ylim([0, max(y)+0.5])
hold on
for i=1:length(tto)
plot(x(i),y(i),'ko')
pause(0.05)
end
elseif y(x==dto)>Oy
for i=1:length(tFinal)
plot(x(i),y(i),'ko')
pause(0.05)
end
end
end
Thanks in advance! :3
  9 件のコメント
Anon
Anon 2021 年 1 月 8 日
Okay that make sense Ryan thank you! I'll try to rewrite that bit
Anon
Anon 2021 年 1 月 8 日
I have changed the value for the dto function thank you Ryan so now i ca get past the If statement howvever i only have two points plotted with this for loop:
for i=1:length(tto)
plot(x(i),y(i),'ko')
pause(0.05)
disp('here now')
end

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by