Histogram visualization for Spatio-temporal data stored in a cell array.

1 view (last 30 days)
I have a cell array (attached) of size 1X40; each cell is a double of size 110 X 120. this is a Spatio-temporal data. I would like to visualize histograms for each time interval by stacking these individual histograms.

Answers (1)

Image Analyst
Image Analyst on 5 Feb 2017
Try this:
% Cleanup/initialization
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
% clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
s = load('m1.mat')
m1 = s.m1
for k = 1 : length(m1)
thisData = m1{k};
[counts, binValues] = histcounts(thisData);
plot(binValues(1:end-1), counts, '-', 'LineWidth', 2);
hold on;
end
grid on;
caption = sprintf('Histogram of %d Arrays', length(m1));
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Data Value', 'FontSize', fontSize);
ylabel('Count', 'FontSize', fontSize);
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
  2 Comments
siddharth rawat
siddharth rawat on 9 Feb 2017
Edited: siddharth rawat on 9 Feb 2017
Thanks, Image analyst for your answer, maybe my question is not so clear. I want to visualize this spatiotemporal data as following: https://www.mathworks.com/matlabcentral/answers/259767-3d-histgram-plot-for-n-m-matrix-visualize-result-monte-carlo-simulation
each histogram represents a temporal slice of the spatial data.
Image Analyst
Image Analyst on 9 Feb 2017
So get your slice (single row or column) of your 2-D hist data (like you'd get from hist3), and then call bar()

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!