Effacer les filtres
Effacer les filtres

Trying to extract outliers from array

2 vues (au cours des 30 derniers jours)
FIONA HOTCHKISS
FIONA HOTCHKISS le 7 Déc 2021
Commenté : FIONA HOTCHKISS le 7 Déc 2021
%Point Barrow, Alaska
PB=readtable('daily_flask_co2_ptb.csv');
%create time and CO2 variable
PBdailyt=PB(:,4);
PBdailyCO2=PB(:,7);
PB.t=table2array(PBdailyt);
PB.CO2=table2array(PBdailyCO2);
%extract outliers by finding and replacing with NaN
PB.CO2x=find(PB.CO2 >=450 | PB.CO2 <=300);
for i=1:length(PB.CO2);
PB.CO2x(PB.CO2(i))=NaN;
end
"To assign to or create a variable in a table, the number of rows must match the height of the table."
I used the table2array but the above message is still popping up when I try to find the outliers of the data. I also noticed that all expect the PB.CO2 & PB.CO2x variables are showing up in my workspace. If their is another way to find and extract the outliers that would be helpful.

Réponse acceptée

KSSV
KSSV le 7 Déc 2021
Modifié(e) : KSSV le 7 Déc 2021
%Point Barrow, Alaska
PB=readtable('daily_flask_co2_ptb.csv');
%extract outliers by finding and replacing with NaN
idx = PB.CO2 >=450 | PB.CO2 <=300 ; % <-- you need to think on this condition
PB.Co2(idx) = NaN ;
  1 commentaire
FIONA HOTCHKISS
FIONA HOTCHKISS le 7 Déc 2021
Thank you! That was very helpful

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by