필터 지우기
필터 지우기

Conditional histogram plotting help

조회 수: 3 (최근 30일)
Wesser
Wesser 2021년 4월 14일
댓글: Wesser 2021년 4월 14일
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
Wesser
Wesser 2021년 4월 14일
편집: Wesser 2021년 4월 14일
I had not heard of the "any" function yet. Thank you for the introduction to this. I'm not sure this works though?
town(t,column) looks like this, but much larger and with 4 towns respresented not 10 as in the real situation:
1 4 2 2 3 3 3
1 4 2 2 3 3 1
1 4 2 2 1 3 1
1 4 2 2 1 3 1
1 4 2 2 1 3 1
Each column is one of 7 participants (in this micro example), each row is a point in time.
1=town X
2=town Z
3=town Y
4=town Q
So I if any of the columns, at any point in time, has a 1 or 2 (ie. particiapant lived in towns X and/or Z), I want to plot a histogram of the coresponding column data from MCExpoStart(i,column). he participant in column 2 lived in town Q, so I don't care about thier MCExpoStart data and I don't want to include it in this histogram. So in this example plot the MCExpoStart data for colums 1, 3, 4, 5 and 7, but not 2 and 6.
Wesser
Wesser 2021년 4월 14일
Ok. This makes sense. Thank you for your help with this!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by