我使用以下格式保存了我在Fortran的工作
OPEN(50,file ='h.dat',form='formatted')
WRITE(50,'(101F12.6)')(u(k),k=1,nx)
CLOSE(50)
由于nx = 201,数据保存为2行。第一行有101列,第二行有100列。因此,MATLAB无法读取h.dat,并显示以下消息“......必须与前一行相同”。
是否可以使用Matlab将此2行数据更改为1行数据(201列)?
答案 0 :(得分:0)
hh = importdata(' h.dat');
尺寸(hh)%ans = 2 101
nx = 201;
p = 0;
表示i = 1:2;
for j = 1:101;
p = p+1;
ha(p) = hh(i,j);
end
端
ha = ha(1:nx);
save haa.dat ha -ascii
但是,我认为,使用Fortran解决它会容易得多......