- I suggest you convert the above tables first to actual MATLAB table variables.
- Use categorical to tell the Status column is from a finite set of Success of Fail.
- Finally use logical indexing with the categorical variable (to dig into only rows that are Success or Fail). You can use logical indexing to perform relational operators (Such as <, >, >= etc.) to find if the Spec table is then satisfied or not.
- Take a look at this example that explains a similar workflow.
How to check that the value is within the spec
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I have two tables (1) Data table, (2) Spec Table(includes lower & upper limit). First row shows Variable name (A,B,C,D,E) for the same I have the spec table. Here, NA represents spec not defined,and if a variable value is not double just report (NA). I want to do
1. If the status is Fail, then check the corresponding variables (their value) is within the spec or not, if it is in the spec then report OK, else report Out.My output table is shown.Many thanks in advance.
Data table:
Status A B C D E
Success -0.5 9 2 Positive 12
Fail 7 11 23 Positive 3
Success 1 9 18 Deflect 6
Success 1.3 3 15 Positive 12
Fail -6 6 -1 Negative 1
Success 0.8 4 11 Positive 25
Fail 3 9 26 Positive 30
Spec table:
Lower Upper
A -1.5 1.5
B NA NA
C 0 20
E 5 25
Output:
A B C D E
OK NA OK NA OK
Out NA Out NA Out
OK NA OK NA OK
OK NA OK NA OK
Out NA Out NA Out
OK NA OK NA OK
Out NA Out NA Out
0 件のコメント
採用された回答
Swarooph
2016 年 8 月 4 日
編集済み: Swarooph
2016 年 8 月 4 日
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Database Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!