Filter löschen
Filter löschen

loop for

1 Ansicht (letzte 30 Tage)
zina ben
zina ben am 4 Feb. 2012
Hi,
I have this loop
For i=1:5
a=2*i;
end
I need to stock the value of (a) in the vector for each value of (i)
Please help me. Thanks in advance
  1 Kommentar
Image Analyst
Image Analyst am 4 Feb. 2012
Have you gone through the "Getting Started" documentation yet? You need to or else you'll have a thousand other very basic questions like this.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Andrei Bobrov
Andrei Bobrov am 4 Feb. 2012
1.
i1 = 1:5;
a = i1*2
2.
a = zeros(1,5);
for i1=1:5
a(i1)=2*i1;
end

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by