fill column elements with the column number?
조회 수: 2 (최근 30일)
이전 댓글 표시
How can I fill column elements with the column number. First column contains only 1, second only 2, third only 3, etc.
채택된 답변
Hayden Garmon
2020년 9월 14일
편집: Hayden Garmon
2020년 9월 14일
m=5;% m is length of columns
n=4;% n is number of columns
for i =1:n
A(:,i)=ones(m,1)*i ;
end
A =
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
댓글 수: 4
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Dynamic System Models에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!