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行の3列のデータがあり、等高線図をプロットしたいデータを読みたいです。
x y z 1 2 3 2 3 4 5 5 5 4 4 5
上に示したように、3 つの列のデータがあります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)