I'd like to draw 2D image with excel file data
Show older comments
Hi, I'd like to draw 2D image by matlab.
I have excel file like below image.
Each value means weight(simply, power) of the photon, and I want to draw it by 2D image with different color(following value of weight).
For example, blank of 0.4 has yellow or orange color and blank of 0.9 has red color in 2D image.
Thanks a lot.

Answers (2)
% Enter filename + path here:
filename = 'basic_matrix.xls'
% Get data from excel into array
M = readmatrix(filename);
% plot values
contourf(-M)
% use colormap with needed color scheme
colormap(autumn)
5 Comments
Jaewoo Baek
on 13 Nov 2020
Jaewoo Baek
on 13 Nov 2020
% Enter filename + path here:
filename = 'basic_matrix.xls'
% Get data from excel into array
M = xlsread(filename);
% plot values
contourf(-M)
% use colormap with needed color scheme
colormap(autumn)
Jaewoo Baek
on 14 Nov 2020
FILIPE MAGALHAES
on 3 Mar 2022
0 votes
You can try this command:
z=xlsread("YourExcelFile.xlsx");
surf(z);
You can ajust the image details, eg. axes names and color scale, on the figure.
Categories
Find more on Color and Styling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!