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

조회 수: 1 (최근 30일)
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.

답변 (1개)

Walter Roberson
Walter Roberson 2018년 1월 15일
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);
  댓글 수: 1
FX
FX 2018년 1월 16일
This code was actually from 1993 and it worked back then. Maybe the syntax of zeros has changed in 25 years?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by