본문 바로가기

matlab for2

Using the Matlab 'for Statement' | Loop Statement Using the Matlab 'for Statement' | Loop Statement One of the most confusing things about using various computer languages is the 'for statement.' Each language has different forms, so I search every time I write it. I just wrote down for example, so I hope you can freely scrape and correct it. %% Setting a = zeros(1,10); % make that variable a is 1X10 matrix. %% for loop for i = 1:length(a) % i .. 2020. 9. 24.
매트랩 for 문 사용하기 (반복문 1) 매트랩 for 문 사용하기 여러가지 컴퓨터 언어를 사용하다보면 제일 헷갈리는 것 중 하나가 for문이다. 언어마다 형태가 다 다르니 쓸 때마다 검색하게 된다. 그래서 그냥 for 문 예시를 적어 놓았으니 자유롭게 긁어서 수정하길 바란다. %% Setting a = zeros(1,10); % make that variable a is 1X10 matrix. %% for loop for i = 1:10 % i is from 1 to 10, and is executed repeatedly. if rem(i,2) == 0% if i is even number, a(i) = 1;% 1 is inserted in i^th of a. else% else, a(i) = -1;% -1 is inserted in i^th.. 2020. 8. 4.
반응형