How to perform simple interpolation of excel data on matlab?

4 ビュー (過去 30 日間)
Samantha Chong
Samantha Chong 2015 年 10 月 31 日
編集済み: dpb 2015 年 10 月 31 日
Hi All, I've attached an image of how my .xlsx file looks like so it would be easier to explain my scenario: As you can see from the .xlsx, there are two columns, in the second column, there are some "blank cells", my objective is to perform interpolation in order to fill in the blank cells. I understand that linear interpolation can be performed if the NGap=1, but I really need help with the interpolation when NGap=2, 3, 4, 5. Thank you very much for your kind assistance :)

回答 (1 件)

dpb
dpb 2015 年 10 月 31 日
編集済み: dpb 2015 年 10 月 31 日
x=xlsread('yourExcelFile');
idx=isnan(x(:,2));
x(idx,2)=interp1(x(~idx,1),x(~idx,2),x(idx,1));
doc xlsread
doc interp1 % for details
--

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by