Changing data in excel from NA to a previous number in the column?

6 ビュー (過去 30 日間)
Omar Bayomie
Omar Bayomie 2020 年 7 月 12 日
回答済み: Chaitanya Mallela 2020 年 7 月 16 日
I would like to change NA values for tempreature sensors with a previous number in the same column, to make the values consistent. The columns are more than 10000 rows (cells) of reported data, that's why it has to be automated?

採用された回答

Chaitanya Mallela
Chaitanya Mallela 2020 年 7 月 16 日
T = readtable('filename.csv'); % read the file as table
T = fillmissing(T,'previous'); % fill NaNs with previous values
[r,c] = find(isnan(T{:,:})); % check remaining NaN present as a first value in the columns
if(~(isempty(r) && isempty(c)))
T(r,c) = {0}; % fIll with zeros
end
writetable(T,'filename.csv'); % write the table to file

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by