finding position of matrix using for loop
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Cside
am 23 Okt. 2019
Bearbeitet: Cside
am 23 Okt. 2019
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
0 Kommentare
Akzeptierte Antwort
Tanveer ul haq
am 23 Okt. 2019
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!