Convert txt file with 5 columns to plot a graph

I have a txt file, I wanted to convert to plot an image, the first column is the X axis, the second column is the Z axis, the third column is the X value, the fourth column is the Z value and the fifth column is the value of a pallet. The value of this pallet must change the color of the graph.
I would like to make a graph like this:
How can I do it? Thanks a lot

 Accepted Answer

data = importdata("OLED.DFT_Ey_Convertido.txt") ;
x = data(:,1) ;
y = data(:,2) ;
nx = length(unique(x)) ;
ny = length(unique(y)) ;
X = reshape(x,nx,ny) ;
Y = reshape(y,nx,ny) ;
Z = reshape(data(:,3),nx,ny) ;
pcolor(X,Y,Z)
colorbar
shading interp

2 Comments

Thank you! Worked perfectly.
Do you know how to change the color pattern of the Figure?
Change to one like this:
Thank you again!
Read about colormap.

Sign in to comment.

More Answers (0)

Categories

Asked:

on 9 Jun 2020

Commented:

on 9 Jun 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!