I want loop several sea level change data from the database

1 回表示 (過去 30 日間)
sterben
sterben 2022 年 5 月 11 日
回答済み: Jaynik 2023 年 10 月 6 日
data14years=load('Ziliang_data.mat');
%remove seasonal cycle
%find location that are close to 5
%degrees.(151.0831,156.0832,161.0832,166.0833,171.0833)
seachange1=data14years.zetaData(:,2);
seachange2=data14years.zetaData(:,62);
seachange3=data14years.zetaData(:,n);
days=1:length(data14years.zetaData(:,1));
I want to loop the number of location at 32:30:300 and save these data to get all final

回答 (1 件)

Jaynik
Jaynik 2023 年 10 月 6 日
Hi,
According to my understanding, you want to loop on indices of "data14years.zetaData" initialized at 32 and ending at or before 300 with intervals of 30. You can create a "cell array" to store all the final data and then directly loop over it to store the data. Following is a sample code to perform the loop operation:
finalSeaExchange = cell(1, 10);
index = 1;
for n = 32:30:300
seachangeN = data14years.zetaData(:, n);
% Perform any desired operations on seachangeN here
finalSeaExchange{index} = seachangeN;
index = index + 1;
end
Refer the following link to learn more about "cell array":
Hope this helps!

カテゴリ

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

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by