finding position of matrix using for loop

Hi,
I would like to find the number in A based off the number in the for loop as the position number eg n = 3, the answer should be 13. How should I write this?
A = [11, 12, 13, 14, 15, 16, 17, 18];
for n = 1:8

 채택된 답변

Tanveer ul haq
Tanveer ul haq 2019년 10월 23일

0 개 추천

A = [11, 12, 13, 14, 15, 16, 17, 18];
for n = 1:8
A(i);
end
% Now write A(n) you will get the associated entry with n. e.g.
A(2) % press enter to get 12.

추가 답변 (0개)

카테고리

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

질문:

2019년 10월 23일

편집:

2019년 10월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by