form a row vector
이전 댓글 표시
I have to form a row vector x=[5 6 16 17 27 28 38 39....] till the total number of elements become 'n' where 'n' is entered by the user. Say, I enter n=4 so my x=[5 6 16 17]
basically what I want is that if I have two numbers say, X and Y and I wish to give some increment to these numbers to form a row matrix containing 'n' elements. Say, increment is 3 and n is 6 A=[X Y X+3 Y+3 X+6 Y+6]
댓글 수: 1
akshata k
2015년 3월 9일
for i=1:n
x1(1,n)=x(1,n);
end
채택된 답변
추가 답변 (1개)
Chandrasekhar
2015년 3월 9일
x = [5 6 16 17 27 28 38 39....]
n = input('enter the total number of elements');
x = x[1:n];
disp(x);
댓글 수: 4
Ace_ventura
2015년 3월 9일
Ace_ventura
2015년 3월 9일
Jan
2015년 3월 9일
@Jeff: What have you tried so far and which problems occur? It is much easier to answer, if you show us what you have done so far.
Ace_ventura
2015년 3월 9일
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!