How to number permutation values, 11, 12, 13, 14, etc in "for" loop to be sequentially printed as 1, 2, 3 etc?

조회 수: 1 (최근 30일)
Hi, I am running my simulation using "for" loop. The problem is that I have "i" and "j" orders on which I refer to each value, like 11, 12, 13, 14, etc. I need to, instead, mark them as 1, 2, 3, 4, 5, etc. Is there anyway to do that? Thank you very much.
  댓글 수: 2
Walter Roberson
Walter Roberson 2017년 11월 12일
So for i = 1, just j should be printed? And what should be printed when i = 2?
Ismail Qeshta
Ismail Qeshta 2017년 11월 12일
Hi Walter. Basically, I have a=[ 1 2 3] and b= [1 2 3] and I am running for loop for i = 1:3, and j= 1:3; I need to print the output in terms of 1, 2, 3, 4, etc, instead of 11, 12, 13, 14, etc.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2017년 11월 12일
(i-1)*3 + j

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by