MATLAB: Data availability analyse (Visual )

visual data analyze

Hi gugys. I have a dataset:
K=65x1511 % where 65 is the number of houses and 1511 is the number of measurements.
What i want is to check the data availability of the measurements by plotting a figure like below, where the red pixels mean that the data is available while white mean that it is not available. But since i dont know which function is used to create such a data i'm totally lost.
Plz help.

Best Answer

I am assuming that if data are not available over all Hours and all Days, those data are set to zero. (If something else is the indicator, you will have to make appropriate changes to the code.) Briefly, I created a matrix of random integers that included zero, the took the product across either Hours or Days (since you did not specify what you wanted), so the data were available across all Houses. Any zero over Days or Hours for a particular House would then produce a zero for that House, indicating that at least one datum was missing. I then plotted them.
K = randi(30, 24, 63, 65)-1; % Create Data
HouseXHrs = squeeze(prod(K,2)); % Product across ‘Days’
HouseXHrs(HouseXHrs > 0) = 10;
HouseXHrs(HouseXHrs <= 0) = 60;
HouseXDay = squeeze(prod(K,1)); % Product across ‘Hours’
HouseXDay(HouseXDay > 0) = 10;
HouseXDay(HouseXDay <= 0) = 60;
figure(1)
pcolor(HouseXHrs)
xlabel('Houses')
ylabel('Hours')
axis equal
colormap(jet)
figure(2)
pcolor(HouseXDay)
xlabel('Houses')
ylabel('Days')
axis equal
colormap(jet)
This produces for figure(2):
It is not exactly as you posted, but it is as close as I can get with MATLAB graphics.
Related Question