MATLAB Answers

surf plot from text file

43 views (last 30 days)
i have text with data an di dont know how to create a surface plot using surf function.
X = exportfilecst4(:,1);
Y = exportfilecst4(:,2);
z1 = exportfilecst4(:,4);
z2 = exportfilecst4(:,5);
z3 = exportfilecst4(:,6);
Z = z3;
grid on
this is my code right now
i have attach the text file bellow
can anyone change it to surface plot


Sign in to comment.

Accepted Answer

Akira Agata
Akira Agata on 21 Aug 2019
Like this?
data = dlmread('exportfilecst4.txt');
x = data(:,1);
y = data(:,2);
z = data(:,6);


Stephen Cobeldick
Stephen Cobeldick on 21 Aug 2019
son nguyen xuan's incorrectly accepted "Answer" moved here:
oh thank you so much
son nguyen xuan
son nguyen xuan on 21 Aug 2019
i'm sorry can you explain further how would you choose number 31? cause when i apply the code to another file, it can not produce a result
thank you
Akira Agata
Akira Agata on 21 Aug 2019
Hi son nguyen xuan-san,
This is because, looking at your data, x (=> 1st column) value repeats 31 times.

Sign in to comment.

More Answers (0)

Sign in to answer this question.