Issue creating a heat map of 512x512 matrix.

3 visualizaciones (últimos 30 días)
Noah Wilson
Noah Wilson el 3 de Dic. de 2020
Comentada: Noah Wilson el 3 de Dic. de 2020
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)

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 3 de Dic. de 2020
Editada: Cris LaPierre el 3 de Dic. de 2020
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

Más respuestas (0)

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by