The following Matlab program clc clear all for ef=1:100 ky=linspace(-ef,ef,ef*2); for n=1:3 r(n,:)=2*ky; end end encounters this error: ??? Subscripted assignment dimension mismatch. Error in ==> testarrays at 6 r(n,:)=2*ky; But if I use ky=linspace(-ef,ef); there is no error! why? In other words, what should I do to control the number of ky-points in each loop?