I want loop several sea level change data from the database

2 views (last 30 days)
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

Answers (1)

Jaynik
Jaynik on 6 Oct 2023
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!

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!