下面这段代码老是出现In an assignment A(I) = B, the number of elements in B and I must be the samef_ji=[];f_ou=[];for i=1:length(f) if mod(i,2)~=0 f_ji=[f_ji,f(i)]; else f_ou=[f_ou,f(i)]; end endfor i=1:length(f_ji) g(i)=d(:,f_ji(i):f_ou(i));end哪里出错了
问题描述:
下面这段代码老是出现In an assignment A(I) = B, the number of elements in B and I must be the same
f_ji=[];
f_ou=[];
for i=1:length(f)
if mod(i,2)~=0
f_ji=[f_ji,f(i)];
else
f_ou=[f_ou,f(i)];
end
end
for i=1:length(f_ji)
g(i)=d(:,f_ji(i):f_ou(i));
end
哪里出错了
答
像似 g(i)=d(:,f_ji(i):f_ou(i)); 错了.
出错信息说,A(I) = B 这种形式的赋值语句,B 里的元素个数 与 I 要相等.