필터 지우기
필터 지우기

Is it possible with for loop s1,s2,s3 variable looping ?

조회 수: 1 (최근 30일)
x y
x y 2015년 10월 30일
편집: per isakson 2015년 10월 30일
Hy I wonder it is possible something this (looping with variable name) :
s1 = 5;
s2 = 6;
s3 = 7;
for i = 1:3
s[(i)] or s(i)
end
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2015년 10월 30일
xy - why not just store your three variables in an array as
s = [5 6 7];
and then access each element as
for k = 1:3
% do something with s(k)
end

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

채택된 답변

per isakson
per isakson 2015년 10월 30일
편집: per isakson 2015년 10월 30일

추가 답변 (0개)

카테고리

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