# Show temperature differences in a dataset

4 ビュー (過去 30 日間)
Cliff Karlsson 2018 年 10 月 23 日

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
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');
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 件のコメント表示非表示 1 件の古いコメント
Cliff Karlsson 2018 年 10 月 24 日
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.

サインインしてコメントする。

### 採用された回答

jonas 2018 年 10 月 23 日

Here you can see the difference between minimum and maximum taken over the 3rd dimension, which I can only assume is time?
A = data.measure_matrix;
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...
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

サインインしてコメントする。

### その他の回答 (1 件)

Cliff Karlsson 2018 年 10 月 24 日
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
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);
movegui(FigH, 'center')
function callbackfn(source, eventdata)
num = get(eventdata.AffectedObject, 'Value');
im = B(:,:,round(num));
end
end
##### 3 件のコメント表示非表示 2 件の古いコメント
jonas 2018 年 10 月 26 日
I've updated the script.

サインインしてコメントする。

R2018a

### Community Treasure Hunt

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

Start Hunting!

Translated by