フィルターのクリア

Retrieve condition in if-else loop

1 回表示 (過去 30 日間)
siti khadijah
siti khadijah 2017 年 5 月 8 日
回答済み: Walter Roberson 2017 年 5 月 9 日
Hai guys,
I would like to ask for your opinion on my code. I'm having difficulties on getting a right system code. Here is the idea of my code:
%%Red line 1: decrease
t1 = a + b; % Tmax
t2 = t1 + c; % tcem
t3 = d; %tor_task
%%indicator to increase the red line
if t2 <= t3
t4 = e1 + f1;
if t2 <= 10 % red line 2 : increase
t2 = t1 - 10*t2
%%indicator to decrease the red line 3
if t2 == t1
t2 = t1 + c
end
end
else
t4 = e2 + f2;
t2 = t1 + c;
end
If you guys noticed, there are two ways to calculate the t2:
(1) t2 = t1 + c
(2) t2 = t1 - 10*t2
My question is, how I can ask the code for ' t2 == t1 ' to go to the 'else' at the last part of the code? Is there any ways to do that?
Thanks for your help and idea.
Regards,
Me

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 5 月 9 日
if this
hit_special_case = false;
if that
...
else
hit_special_case = false;
end
else
hit_special_case = true;
end
if hit_special_case
do something appropriate
end

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by