How to fill a data table with gaps

1 回表示 (過去 30 日間)
AA
AA 2018 年 4 月 4 日
回答済み: Walter Roberson 2018 年 4 月 4 日
Hi, I have got this data table with the following values: As you can see from the table below that there are gaps in the second column. For instance, 109, 110, 111, 112 are missing. At the same time, 120 is also missing. This table has 1000 rows and I have only shown a fraction of the table. Is there a way I can fill the table automatically in such a way that the gaps are filled the values from the columns 3,4,5 and 6 one row above? Thanks for the help.
732315 108 1.9193000 1.9193000 1.9193000 1.9193000
732315 113 1.9193000 1.9193000 1.9060000 1.9060000
732315 114 1.9058000 1.9058000 1.9058000 1.9058000
732315 115 1.9060000 1.9061000 1.9060000 1.9060000
732315 116 1.9061000 1.9065000 1.9060000 1.9064000
732315 117 1.9065000 1.9067000 1.9062001 1.9067000
732315 118 1.9066000 1.9072000 1.9066000 1.9072000
732315 119 1.9071000 1.9076999 1.9065000 1.9074000
732315 121 1.9075000 1.9079000 1.9074000 1.9076999
732315 122 1.9080000 1.9080000 1.9068000 1.9078000
732315 123 1.9076999 1.9079000 1.9076999 1.9079000
732315 124 1.9078000 1.9079000 1.9076000 1.9076999

採用された回答

Walter Roberson
Walter Roberson 2018 年 4 月 4 日
Convert your data to a timetable() and use fillmissing() with an appropriate method such as 'previous' or possibly 'linear'

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by