Replace NaN values with median for each row
Show older comments
Hi guys,
I have this table:
Date var_1 var_2 var_3 var_4 var_5 var_6
01-01-90 0.2 0.34 0.43 0.12 0.18 0.1
01-01-91 0.3 0.54 0.53 0.62 0.38 0.2
01-01-92 0.7 0.40 0.77 0.42 NaN 0.2
01-01-93 0.7 0.40 0.77 0.42 NaN 0.2
How do I replace the NaN values in the table with the median of the row for each row?
The result for this table should be:
Date var_1 var_2 var_3 var_4 var_5 var_6
01-01-90 0.2 0.34 0.43 0.12 0.18 0.1
01-01-91 0.3 0.54 0.53 0.62 0.38 0.2
01-01-92 0.7 0.40 0.77 0.42 Med_Row 0.2
01-01-93 0.7 0.40 0.77 0.42 Med_Row 0.2
1 Comment
KSSV
on 9 Jul 2020
Read about fillmissing
Accepted Answer
More Answers (0)
Categories
Find more on Data Preprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!