I want the following output:
period 1 step 1
save
period 1 step 2
save
period 2 step 1
save
and continue on in this manner.
I wrote the following code but I'm just getting it to print period (i) ten times over in one line.
for i=1:10
for j=1:2
fprintf("period (i)", "step (j)", '\n', '\t', "save")
end
end

 채택된 답변

Dennis
Dennis 2018년 10월 17일
편집: Dennis 2018년 10월 17일

0 개 추천

for i=1:10
for j=1:2
fprintf('period %d step %d \nsave\n',i,j)
end
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

릴리스

R2018a

태그

질문:

2018년 10월 17일

편집:

2018년 10월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by