Show temperature differences in a dataset

2 visualizzazioni (ultimi 30 giorni)
I have a data-set with 360*512*237 temperature readings. The actual readings is 360*512 and there are 237 readings.
I want to visualize in some nice way using a slider or other method where the temperatures fluctuate the most for example. Can anyone tell me different methods for visualizing this data.
This is the code I got for now:
if exist('matrix_values_year.mat', 'file') == 2
load('matrix_values_year.mat');
else
file = dir('data\\year\\*.OTT');
measure_matrix = [];
for i = 1:size(file, 1)
if file(i).bytes <= 2000 | file(i).bytes > 70000 ;
measure_matrix = cat(3,measure_matrix,measure_matrix(:,:,i-1));
else
filnamn = string(strcat(file(i).folder,{'\'},file(i).name));
measure_matrix = cat(3,measure_matrix,getHeatMap(filnamn));
end
end
save matrix_values_year.mat measure_matrix;
end
max_difference = 0
measure_matrix = rescale(measure_matrix,50,450, 'InputMin', 0,'InputMax',255);
column_matrix = zeros(512,237);
x=0;
y=0;
for i=1:237
for j=1:512
differance = (max(measure_matrix(:,j,i)) - min(measure_matrix(:,j,i)));
column_matrix(j,i) = differance;
if( differance > max_difference )
max_difference = differance;
x=i;
y = j;
end
end
end
sample = measure_matrix(:,:,50);
figure
h= histogram(column_matrix)
figure
mesh(column_matrix')
view(-15,20)
function heat = getHeatMap(filename_s)
s = dir(filename_s);
fin=fopen(filename_s,'r');
I=fread(fin,s.bytes,'uint8=>uint8');
fclose(fin);
w = uint16(I(1))+256*uint16(I(2));
h = uint16(I(3))+256*uint16(I(4));
skip = s.bytes - w*h + 1;
IN = I(skip:1:s.bytes);
Z=single(reshape(IN,w,h));
Z=griddedInterpolant(Z');
y_range = linspace(1.0,single(h),360);
x_range = linspace(1.0,single(w),512);
heat = uint8(Z({y_range, x_range}));
end
  2 Commenti
jonas
jonas il 23 Ott 2018
Modificato: jonas il 23 Ott 2018
What does the row/column index represent? Spatial location? What do you mean fluctuate the most? Biggest difference between min and max value?
Cliff Karlsson
Cliff Karlsson il 24 Ott 2018
Yes correct, the row/columns represent an area with different temperature readings. I want to be able to maybe use some sort of slider to be able to compare different reading to eachother.

Accedi per commentare.

Risposta accettata

jonas
jonas il 23 Ott 2018
Modificato: jonas il 26 Ott 2018
Here you can see the difference between minimum and maximum taken over the 3rd dimension, which I can only assume is time?
data = load('matrix_values_year.mat');
A = data.measure_matrix;
Ad = max(A,[],3) - min(A,[],3);
surf(Ad,'edgecolor','none')
view([0 90])
axis tight
set(gca,'layer','top')
colorbar
You probably want to use some variety of surface plot. There are several types, such as contourf, pcolor, imagesc, mesh, imshow etc...
Slider option (code adapted from OP's 'answer')
data = load('matrix_values_year.mat');
B = data.measure_matrix;
FigH = figure('position',[360 500 400 400]);
axes('XLim', [0 512],'units','pixels', ...
'position',[100 50 200 200], 'NextPlot', 'add'); hold on
cb = colorbar(gca)
cb.Limits= [0 100]
set(gca,'CLim',[0 100])
im = mesh(B(:,:,1));
axis tight
set(gca,'ZLim',[0 100]);
TextH = uicontrol('style','text',...
'position',[170 340 40 15]);
SliderH = uicontrol('style','slider','position',[100 280 200 20],...
'Value',1,'min', 1, 'max', 237,'callback',{@callbackfn,B,im});
function callbackfn(source, eventdata,B,im)
num = eventdata.Source.Value;
im.CData = B(:,:,round(num));
im.ZData = B(:,:,round(num));
set(gca,'ZLim',[0 100])
end

Più risposte (1)

Cliff Karlsson
Cliff Karlsson il 24 Ott 2018
I tried to understand how to add a slider, but the image does not update when I move the slider. What am I doing wrong?
function sliderfun
data = load('matrix_values_year.mat');
B = data.measure_matrix;
FigH = figure('position',[360 500 400 400]);
axes('XLim', [0 512], 'units','pixels', ...
'position',[100 50 200 200], 'NextPlot', 'add');
im = mesh(B(:,:,1));
TextH = uicontrol('style','text',...
'position',[170 340 40 15]);
SliderH = uicontrol('style','slider','position',[100 280 200 20],...
'min', 0, 'max', 237);
addlistener(SliderH, 'Value', 'PostSet', @callbackfn);
movegui(FigH, 'center')
function callbackfn(source, eventdata)
num = get(eventdata.AffectedObject, 'Value');
im = B(:,:,round(num));
end
end
  3 Commenti
Cliff Karlsson
Cliff Karlsson il 26 Ott 2018
Modificato: Cliff Karlsson il 26 Ott 2018
Thanks for the answer. But I have one problem, if I rotate the figure so that I also see the elevation of the plot, only the colors update on each click not the actual shape of the plot.
jonas
jonas il 26 Ott 2018
I've updated the script.

Accedi per commentare.

Categorie

Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by