reshape再转置, image2=(reshape(image))
使用了双回圈当然会变慢! 若一定要用, 试试先初始化!
image2=zeros(rows,cols); for i = 1:rows, for j = 1:cols, image2(i,j) = image((i-1)*cols+j); end; end
或少个回圈
image2=zeros(rows,cols); for i = 1:rows, image2(i,:) = image((i-1)*cols+1:i*cols); end