MAtlab中To RESHAPE the number of elements must not change.N1=14328;N2=14328;fid=fopen('ddfield.E15','r');size=fscanf(fid,'%g');fclose(fid);aa1=reshape(size,9,N1*N2);% X=reshape(aa1(1,:),N1,N2);% Y=reshape(aa1(2,:),N1,N2);% Z=reshape(aa1(3,:),N1,N2);
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 15:22:28
MAtlab中To RESHAPE the number of elements must not change.N1=14328;N2=14328;fid=fopen('ddfield.E15','r');size=fscanf(fid,'%g');fclose(fid);aa1=reshape(size,9,N1*N2);% X=reshape(aa1(1,:),N1,N2);% Y=reshape(aa1(2,:),N1,N2);% Z=reshape(aa1(3,:),N1,N2);
MAtlab中To RESHAPE the number of elements must not change.
N1=14328;
N2=14328;
fid=fopen('ddfield.E15','r');
size=fscanf(fid,'%g');
fclose(fid);
aa1=reshape(size,9,N1*N2);
% X=reshape(aa1(1,:),N1,N2);
% Y=reshape(aa1(2,:),N1,N2);
% Z=reshape(aa1(3,:),N1,N2);
X=linspace(-15,15,N1);
Y=linspace(-15,15,N2);
Ex=reshape(aa1(4,:),N1,N2)+i*reshape(aa1(5,:),N1,N2);
Ey=reshape(aa1(6,:),N1,N2)+i*reshape(aa1(7,:),N1,N2);
Ez=reshape(aa1(8,:),N1,N2)+i*reshape(aa1(9,:),N1,N2);
E=(abs(Ex).^2+abs(Ey).^2+abs(Ez).^2).^(1/2);
figure,imagesc(X,Y,E)
colorbar
MAtlab中To RESHAPE the number of elements must not change.N1=14328;N2=14328;fid=fopen('ddfield.E15','r');size=fscanf(fid,'%g');fclose(fid);aa1=reshape(size,9,N1*N2);% X=reshape(aa1(1,:),N1,N2);% Y=reshape(aa1(2,:),N1,N2);% Z=reshape(aa1(3,:),N1,N2);
你要reshape的话变之前和变了之后元素总数得相等, 你不可能把一个1000个元素的矩阵reshape成含有2000元素的矩阵