suppose in c language we have a condition like k=0;k<j;k++
how we write this code in matlab?

 채택된 답변

Raj
Raj 2019년 4월 3일

0 개 추천

k=0;
while k<j
k=k+1
end

추가 답변 (2개)

Pruthvi G
Pruthvi G 2019년 4월 3일
편집: Pruthvi G 2019년 4월 3일

0 개 추천

Increment of 1
for k = 1:1:j % Increment of 1
% do operations
end
Increment of 2
for k = 1:2:j % Increment of 2
% do operations
end
Decrement from j to 1 in step of 1
for k = j:-1:1 % Decrement of -1
% do operations
end
Please Accept answer if you understood, else ping me for advanced help
Sanjoy Dey
Sanjoy Dey 2019년 4월 3일
편집: Sanjoy Dey 2019년 4월 3일

0 개 추천

i know syntax of for loop--- for index=initial value : step size: final value
but i want to know the condition k<j,how i write this condition?

카테고리

도움말 센터File Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

질문:

2019년 4월 3일

편집:

2019년 4월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by