Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有三列数据,文本文件中有 n 行,我想读取要绘制等高线图的数据。
x y z 1 2 3 2 3 4 5 5 5 4 4 5
如上所示,我有三列数据x, y, z。现在我想读取每个x, y,z数据并绘制在等高线图中。
x, y, z
x
y
z
我设法做的是
[gnd, x, y] = textread('abc.txt', '%n,%n,%n'); contourf(x,y,gnd)
对于阅读这应该有效:
fid = fopen('abc.txt'); fgets(fid); % to get rid of the first line of characters ("x y z") A = textscan(fid, '%f %f %f'); x = A{1}; y = A{2}; z = A{3};
但是数据似乎不是很结构化。所以也许scatter(x,y,5,z)可能是更好的绘图选项?
scatter(x,y,5,z)