Azzera filtri
Azzera filtri

Trying to extract outliers from array

2 visualizzazioni (ultimi 30 giorni)
%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.

Risposta accettata

KSSV
KSSV il 7 Dic 2021
Modificato: KSSV il 7 Dic 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 ;

Più risposte (0)

Categorie

Scopri di più su Tables in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by