MATLAB Answers

1

how to jump a single for step in a for loop?

I am writing a code for fuel consumption for that i want to use a for loop which calculates Speed of the motor
for k=1:1:150
Speed = k*100
if Speed <1000
% At this point i want to jump this for step
end
torque=15
FuelConsumption=Speed*torque
end
As we can directly catch that i can also start from 10 to avoid this problem
But the same Speed i am using for further calculation where i need the values less than 1000 too.

  5 Comments

somehow i need to use the loop for my calculation and break would jump the whole loop and not just one step
KSSV
on 5 Feb 2019
Read about continue
thats the perfect solution
thanx alot

Sign in to comment.

1 Answer

Answer by madhan ravi
on 5 Feb 2019
 Accepted Answer

if ...
continue % just add this inbetween
end

  0 Comments

Sign in to comment.