restricting the number between limits

1 回表示 (過去 30 日間)
Offroad Jeep
Offroad Jeep 2015 年 9 月 9 日
回答済み: Hamoon 2015 年 9 月 9 日
clc
clear all
a = 10
b = rand(1)
nmc = 100
for i = 1:nmc
c = a - b
if c < a
a = c
else
a = a
end
end
I want to stop the code when value is between 1 and 0 kindly guide

回答 (1 件)

Hamoon
Hamoon 2015 年 9 月 9 日
insert this into for loop:
if (value > 0) && (value < 1)
break;
end

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by