第1个回答 推荐于2017-09-09
问题描述:这样的一个u.txt文件,用matlab从中读取数据,每次只读
取一行进行处理,然后继续...u.txt文件如下: 14 19 337 312 12
16 33 31 19 19 36 32 12 17 33 11 14 10 36 11 42 11 36 11
12 71 35 31 43 17 33 10 45 72 35 21
答案1:: 编写mymesh()函数:
function mymesh()
temdat=load('D:\test.txt');
if temdat== -1
('Error opening the file');endfigure;h=plot3(temdat(:,1),temdat(:,2),temdat(:,3));
set(h,'linestyle','none')hold on;grid on;[x,y]=meshgrid(linspace(-150,150,500),linspace(-
150,150,500));
z = griddata(temdat(:,1),temdat(:,2),temdat(:,4),x,y);
meshc(x,y,z);
axis([0,180,0,180]);
matlab读取txt文档数据
答案1:: 编写mymesh()函数:
function mymesh()
temdat=load('D:\test.txt');
if temdat== -1
('Error opening the file');endfigure;h=plot3(temdat(:,1),temdat(:,2),temdat(:,3));
set(h,'linestyle','none')hold on;grid on;[x,y]=meshgrid(linspace(-150,150,500),linspace(-
150,150,500));