assign subscrips to vectors
이전 댓글 표시
I have 5 vectors yt1, yt2, yt3,yt4,yt5 of size 200*1.
I need to assign subscripts so that I can call the vector I want in side a loop.
Can you please help me with this?
Thanks
채택된 답변
추가 답변 (2개)
Youssef Khmou
2013년 3월 12일
hi, try :
N=200;
for n=1:N
yt1(n)=.............
yt2(n)=.......
.....
end
댓글 수: 4
dav
2013년 3월 12일
Youssef Khmou
2013년 3월 12일
yes, say that i want to add the vector yt1 10 times
yt1=randn(100,1);
N=10;
S=zeros(size(yt1));
for n=1:N
S=S+yt1;
end
dav
2013년 3월 12일
Youssef Khmou
2013년 3월 12일
alright, i dont think that is possible but you can construct a matrix that contains the vectors :
yt1=rand(200,1);
yt2=rand(200,1);
yt3=rand(200,1);
yt4=rand(200,1);
yt5=rand(200,1);
Y=[yt1';yt2';yt3';yt4';yt5'];
for m=1:5
ym=Y(m,:);
end
ok?
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!