MATLAB Answers

0

How to exclude data based on quality control flags

Asked by Addie Norgaard on 15 Oct 2019
Latest activity Edited by Adam Danz
on 18 Oct 2019 at 12:08
Hi,
I have a data set where each value has a quality control flag associated with it. What would be the most effecient way for me to exclude and include values based on QC value?

  3 Comments

There's not enough detail in your question. Let's assume you have a vector of data "x" and a vector of QC values "qc". I assume the qc values are numeric or logical.
If they are logical and 'true' means "keep",
x(qc) %this eliminates any of the bad data
% or
x(qc) = NaN; % This replaces any of the bad data with "missing" data
The benefit of the 2nd line above is that the size and index values of 'x' do not change.
If your qc values are numeric and range from j to i, you can set a threshold 't' where any qc values greater than t are accepted.
xAccepted = x(qc > t);
% or
x(qc <= t) = NaN;
Apologies for the lack of detail. x(qc <= t) = NaN; is a great solution. Thank you Adam Danz!
Great! I copied the comment as an answer below so your question appears as solved.

Sign in to comment.

Products


Release

R2018b

1 Answer

Answer by Adam Danz
on 16 Oct 2019 at 16:52

(continued from comments under question).
Assuming you have a vector of data "x" and a vector of QC values "qc" and the qc values are logical where 'true' means "keep",
x(qc) %this eliminates any of the bad data
% or
x(qc) = NaN; % This replaces any of the bad data with "missing" data
The benefit of the 2nd line above is that the size and index values of 'x' do not change.
If your qc values are numeric and range from j to i, you can set a threshold 't' where any qc values greater than t are accepted.
xAccepted = x(qc > t);
% or
x(qc <= t) = NaN;

  0 Comments

Sign in to comment.