Azzera filtri
Azzera filtri

zeros function: is this old syntax and what does this line mean? Error using zeros Size inputs must be scalar.

2 visualizzazioni (ultimi 30 giorni)
Error using zeros
Size inputs must be scalar.
From the line:
X=zeros(N,1:(n+1));
The code example is from year 1998, is this still valid syntax or is there something I don't just get?
Thanks for help.

Risposte (1)

Walter Roberson
Walter Roberson il 15 Gen 2018
The only time that code was valid was if n happened to be 0, in which case the code would have been the same as X=zeros(N,1:1) which would have been X=zeros(N,1) which is valid.
If you are trying to declare an array which is N by (n+1) then you need
X=zeros(N,n+1);

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by