? Subscript indices must either be real positive integers or logicals. 什么错误啊?n=[1:15];x=zeros(1,15);x=rand(1,10);z=zeros(1,15);y=[x,0,0,0,0,0];forj=3:1:12z(j)=y(j-2)endsubplot(2,1,1);stem(n,y);subplot(2,1,2);stem(n,z)
问题描述:
? Subscript indices must either be real positive integers or logicals. 什么错误啊?
n=[1:15];x=zeros(1,15);x=rand(1,10);z=zeros(1,15);y=[x,0,0,0,0,0];
forj=3:1:12
z(j)=y(j-2)
end
subplot(2,1,1);stem(n,y);subplot(2,1,2);stem(n,z)
答
Subscript indices must either be real positive integers or logicals下标索引必须是正整数类型或者逻辑类型出错原因:在访问矩阵(包括向量、二维矩阵、多维数组,下同)的过程中,下标索引要么从 0 开始,要么出现...