Conditional histogram plotting help

22 views (last 30 days)
Wesser
Wesser on 14 Apr 2021
Commented: Wesser on 14 Apr 2021
Hi,
I'm trying to figure out how to plot only certain output data if certain conditions are met.
I have a 10000x207 matrix. Each column representing one of the 207 participants in a study, who were subject to 10k monte carlo (MC) iterations of a health analysis. I use the following to plot a histogram of all the MC iterations for all the participants:
figure
h = histogram(MCExpoStart);
xlabel('Start of PFHxS Exposure')
ylabel('Count')
title('Histogram of start of exposure for all study participants')
I'd like to then selectively plot participant data from this original matrix based on certain conditions being met in another matrix. For example, I have another matrix (98x207) that represents where the 207 participants lived over 98 sequential time intervals. This is a matrix made up of numbers 1 through 10, which represent 10 different municipalities. So for example, if a participant has a 1 at a given time, it means that the person lived in town X, but if there is a 2 at an interval the person lived in town Y, 3 = town Z, etc. I'd like to make a histogram of the original MCExpoStart data, but only for the people that lived in towns X and Y at any point in time. I imagine the code would be something like this, but this isn't working... Any suggestions out there? Many thanks in advance!!
figure
if (town(t,column)==1) && (town(t,column)==2) %t=time interval
h = histogram(MCExpoStart(i,column)); %i=monte carlo iteration, column=participant in study
xlabel('Start of PFAS Exposure')
ylabel('Count')
title('Histogram of start of exposure for all X and Y residents')
else
end
  4 Comments
Wesser
Wesser on 14 Apr 2021
Ok. This makes sense. Thank you for your help with this!

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!