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 日間)
Timothy Nikoley
Timothy Nikoley 2016 年 11 月 15 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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