How to create vector

조회 수: 6 (최근 30일)
cemsi888
cemsi888 2015년 8월 13일
편집: Jon 2015년 8월 14일
Hi ı have 4 constant values just 5.th element of my vector ıs not stable. for 5.th element of my vector i have 10000 values. thats why ı want to create 5*10000 matrix. its like that a=cst b=cst c=cst d=cst e=[]1*10000 what ı want to create ıs vector=[a,b,c,d,e(1)] vector=[a,b,c,d,e(2)].... my code is
for k=length(vol_5):-1:1
vol=[vol_1,vol_2,vol_3,vol_4,vol_5(1,k)]
end
but i got error. ı know it is very simple but i could not solve this problem.could you please help me?
My error=In an assignment A(I) = B, the number of elements in B and I must be the same.
  댓글 수: 1
cemsi888
cemsi888 2015년 8월 13일
do not you have any idea??

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

답변 (1개)

Jon
Jon 2015년 8월 14일
편집: Jon 2015년 8월 14일
You should always include the error message. It tells you (and me) what the problem is. See if this works:
vol = zeros(length(vol_5),5);
for k=length(vol_5):-1:1
vol(k,:)=[vol_1,vol_2,vol_3,vol_4,vol_5(k)]
end
If only vol_5 is changing, why store all the extra variables (vol_1-vol_4) 10,000 times?

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by