Clear Filters
Clear Filters

How can i write three different condition in a single loop

1 view (last 30 days)
I want to write three different condition in single loop. My three conditions are;
if i==1
if 1<i<N
if i==N

Accepted Answer

Matt J
Matt J on 11 May 2022
for i=1:N
if i==1
elseif i<N
else %i==N

More Answers (0)


Find more on Loops and Conditional Statements 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!