Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

I have a for loop that generates an 1890x1 matrix, I need to insert a zero into the first entry in the first row, so that the final matrix is 1891x1.

조회 수: 2 (최근 30일)
What code do I use to add that in so it does not need to be manually added every time I run the script?

답변 (1개)

Adam
Adam 2016년 11월 15일
편집: Adam 2016년 11월 15일
myMatrix = [0; myMatrix];
If you know the size of the matrix in advance though it would be more efficient to create a 1891 x1 matrix using
myMatrix = zeros(1891,1);
And then just start your loop indexing from 2 to 1891.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by