Show temperature differences in a dataset
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Cliff Karlsson
am 23 Okt. 2018
Bearbeitet: jonas
am 26 Okt. 2018
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 Kommentare
Akzeptierte Antwort
jonas
am 23 Okt. 2018
Bearbeitet: jonas
am 26 Okt. 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
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!