필터 지우기
필터 지우기

loop for

조회 수: 1 (최근 30일)
zina ben
zina ben 2012년 2월 4일
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
Image Analyst
Image Analyst 2012년 2월 4일
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.

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

답변 (1개)

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

카테고리

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