how to use two while and for loops?
Show older comments
hi to all:
i have two condition in my problem in matlab.
(1) matlab should run the first statement when x<1 .
(2) when x reaches to x>1 or x=1 the matlab should run the second statement.
thanks from all of you
Answers (1)
KSSV
on 7 Mar 2021
if x < 1
statement1
elseif x >= 1
statement2
end
6 Comments
Engineer Batoor khan mummand
on 7 Mar 2021
Engineer Batoor khan mummand
on 7 Mar 2021
Edited: Engineer Batoor khan mummand
on 7 Mar 2021
KSSV
on 7 Mar 2021
[m,n] = size(x) ;
for i = 1:m
for j = 1:n
if x(i,j) < 1
statement1
elseif x(i,j) >= 1
statement2
end
end
end
Engineer Batoor khan mummand
on 7 Mar 2021
Engineer Batoor khan mummand
on 7 Mar 2021
Engineer Batoor khan mummand
on 7 Mar 2021
Categories
Find more on Simulink 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!