필터 지우기
필터 지우기

Using Variables

조회 수: 1 (최근 30일)
DanielFromIllinois
DanielFromIllinois 2011년 10월 5일
Hi, I have a set of code that has about 64 different variables. I'm now trying to store them into a matrix. I named the variables so they would be easily used in a for loop when putting them into a matrix but now i dont think i'll be able to use them. Here is my code:
for ii = 1:8
for jj = 1:8
I(ii, jj) = Iiijj
end
end
Where an example of an I variable looks like I31. Is it possible to reference a variable using variables??
Thanks,
Dan

채택된 답변

Image Analyst
Image Analyst 2011년 10월 5일
No. Whatever you did to assign values to I1111, I1211, I1311, etc. should have been used to create your I(,) matrix directly and immediately without creating 64 useless and uniquely-named, temporary, intermediate variables.
for ii = 1:8
for jj = 1:8
I(ii, jj) = (whatever you did before);
end
end
  댓글 수: 1
DanielFromIllinois
DanielFromIllinois 2011년 10월 5일
Thanks. Already started rewriting. DOOH!

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

추가 답변 (1개)

bym
bym 2011년 10월 5일

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by