フィルターのクリア

How to interpolate a different ranges of data in one array of a cell?

2 ビュー (過去 30 日間)
Thao Linh Tran
Thao Linh Tran 2018 年 9 月 10 日
コメント済み: Thao Linh Tran 2018 年 9 月 13 日
I have one cell of storm data including different column arrays such as year, sid, time, name, lat, lon (look at the attachment for more detail), I would like interpolate from 3 hours interval at present to 1 hour interval for lat, lon arrays of each storm using "cubic" method. I can do for one storm as below.
t1= 0:3:lines % lines is the number of intervals of that storm
t2= 0:1:((lines-1)*3)
lat2= interp1(t1,lat1,t2,'cubic');
lon2= interp1(t1,lonw1,t2,'cubic');
How can I count the number of intervals of each storm (different storms are defined by sid) then interpolate values of lat, lon for each of them? Thanks in advance!

採用された回答

ADragon
ADragon 2018 年 9 月 10 日
Hi Thao, you can auto generate a script to import your data as a table and index into it using the column names. See attached for an example script. Then you can do something like the following to get only storm '1988219N27175'.
idx = find(data.sid == '1988219N27175');
lines = numel(idx);
lat1 = data.lat(idx);
lon1 = data.lon(idx);
AD
  1 件のコメント
Thao Linh Tran
Thao Linh Tran 2018 年 9 月 13 日

Thank you for your help. I also found another way to solve this using unique function to count the number of timesteps of each storm and then do interpolation.

[TC, ~, J]=unique(sid); 
interval = histc(J,1:numel(TC));

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by