# Threshold exceedance, where and by how much

조회 수: 3 (최근 30일)
Daphne PARLIARI . 2021년 6월 1일
댓글: Daphne PARLIARI . 2021년 6월 2일
Hi guys!
I would love your help on this one:
I have an excel file (see attached) which contains daily values of ozone for three stations (A, B, C). For every day I want to check whether any of these three stations exceed the daily threshold oh 100 μg/m3, which station has exceeded the threshold (if any), and by how many digits.
E.g., 01/01/2006, A, 2 μg/m3
Is there a simple way to do this?
PS. I'm on Matlab 2019

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

### 채택된 답변

Steven Lord 2021년 6월 1일
Assuming you're reading this data into a table array like this sample one:
T = table(LastName, Age, Height, Weight);
ans = 8×4 table
LastName Age Height Weight ____________ ___ ______ ______ {'Smith' } 38 71 176 {'Johnson' } 43 69 163 {'Williams'} 38 64 131 {'Jones' } 40 67 133 {'Brown' } 49 64 119 {'Davis' } 46 68 142 {'Miller' } 33 64 142 {'Wilson' } 40 68 180
We can use logical indexing to determine who weighs over 150 pounds.
isOver150 = T.Weight > 150;
patientsOver150 = T(isOver150, :);
ans = 8×4 table
LastName Age Height Weight ____________ ___ ______ ______ {'Smith' } 38 71 176 {'Johnson' } 43 69 163 {'Wilson' } 40 68 180 {'Moore' } 28 68 183 {'Jackson' } 25 71 174 {'White' } 39 72 202 {'Martin' } 48 71 181 {'Thompson'} 32 69 191
You can see that the first two rows of T are included in patientsOver150 since their weights are 176 and 163 respectively. The next row in patientsOver150 is row 10 of T since rows 3-9 all represent patients with weights under 150. In both cases I'm only showing 10 rows of the tables, which is why the display of patientsOver150 has rows that don't appear in the display of T.
Now to see by how much the patients' weights exceed 150 pounds just compute with that table variable and assign to a new table variable:
patientsOver150.weightOver150 = patientsOver150.Weight - 150;
ans = 8×5 table
LastName Age Height Weight weightOver150 ____________ ___ ______ ______ _____________ {'Smith' } 38 71 176 26 {'Johnson' } 43 69 163 13 {'Wilson' } 40 68 180 30 {'Moore' } 28 68 183 33 {'Jackson' } 25 71 174 24 {'White' } 39 72 202 52 {'Martin' } 48 71 181 31 {'Thompson'} 32 69 191 41
##### 댓글 수: 1표시 없음숨기기 없음
Daphne PARLIARI 2021년 6월 2일
Thank you for the help!
The problem is that I have three columns that I want to check for exceedance, and the example works for one. Which means that I can't generate patientsOver150 for my data...
How can I solve this?

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

### 카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by