data extraction for a specific period over a long data.

2 次查看(过去 30 天)
Hi Folks,
I have written the following script and it works for a single period correctly. Can some one help me to amend the code to look at the every 500 steps and compare 50 steps over the file of 1000 steps after comparing the 2 files.
NN=1000;
N=50;
for i=1:NN
for j=1:N
if (east(j)== xx(i))
if (north(j)==yy(i))
x(j)=xx(i);
y(j)=yy(i);
ele(j)=zz(i);
UU(j)=u(i);
VV(j)=v(i);
hh(j)=h(i);
end
end
end
end

采纳的回答

Manikanta Aditya
Manikanta Aditya 2024-4-28
Hi @Salim,
Check this code where I modified the script to compare every 500 steps and 50 steps over a file of 1000 steps:
To modify the code to look at every 500 steps and compare 50 steps over a file of 1000 steps, you can use nested loops with appropriate step sizes.
NN = 1000; % Total number of steps
N = 50; % Number of steps to compare
step_size = 500; % Step size for comparison
for i = 1:step_size:NN % Loop over every 500 steps
for j = 1:N % Loop over the 50 steps to compare
if (east(j) == xx(i+j-1)) % Check if east coordinate matches
if (north(j) == yy(i+j-1)) % Check if north coordinate matches
x(j) = xx(i+j-1); % Store x coordinate
y(j) = yy(i+j-1); % Store y coordinate
ele(j) = zz(i+j-1); % Store elevation
UU(j) = u(i+j-1); % Store u value
VV(j) = v(i+j-1); % Store v value
hh(j) = h(i+j-1); % Store h value
end
end
end
end
Hope this helps.
  7 个评论
Salim
Salim 2024-5-1
Thank you very much. It is now working. Many thanks for your support and dedication.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by