嵐の期間を決定するために、特定の嵐のすべての観測と複数の嵐の間のハリケーン観測間の連続した時間 (変数 'hrs') を累積的に合計しようとしています。これは私が持っているものです:
stormid = [188, 188, 288, 288, 288, 388, 488, 488, 588...] %numbers represent a unique
% code identifying a particular storm (i.e. 188= 1st storm of 1988)
hrs = [0,6,0,6,6,0,0,6,0...] %hours between observations in each storm
% where 0 indicates the start of a storm (this corresponds with the stormid above)
私の目標は、各ストーム ID の時間を合計することなので、accumarray を使用するとうまくいくと思いましたが、うまくいきませんでした。これが私が試したものです。
duration= accumarray(stormid, hrs, []);
次に、cumsum も試しましたが、ストーム ID が同じ場合にのみ cumsum を使用する方法がわかりませんでした。
誰かに何かアイデアがあれば、大歓迎です!ありがとう。