Issue creating a heat map of 512x512 matrix.

2 次查看(过去 30 天)
I am trying to create a 'image' using a heatmap for this data from a CCD camera in the lab. Each data point is the value from one pixel so I am trying to get matlab to plot that as a heatmap or something similar and cannot figure out how to do so. I appreciate any help you can give me. I attached my current code and the sample data I am working with.
%Input the folder location containing data that is being analyzed
MainFolder = 'C:\Users\nefwa\Downloads\Test';
cd(MainFolder)
rawdatafile = dir('*.csv');
rawdata = rawdatafile.name;
RawDataMatrix = csvread(rawdata, 32, 0);
RawDataMatrix(:,514) = [];
RawDataMatrix(:,1) = [];
xvar = [1:512];
yvar = [1:512];
heatmap(RawDataMatrix, xvar)

采纳的回答

Cris LaPierre
Cris LaPierre 2020-12-3
编辑:Cris LaPierre 2020-12-3
I suggest using readmatrix instead of csvread.
With a 512x512 matrix, I would suggest imagesc instead of heatmap. Rows correspond to Y, and columns correspond to X. I use colormap jet because it uses a broader range of colors, making differences easier to see.
RawDataMatrix = readmatrix("WaterVapor_660_Dec 2 2020_372.csv","NumHeaderLines", 32);
RawDataMatrix(:,1) = [];
imagesc(RawDataMatrix)
colormap jet
colorbar
However, should you prefer heatmap, try the following.
heatmap(RawDataMatrix,'GridVisible','off');
colormap jet

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by