data extraction for a specific period over a long data.
1 view (last 30 days)
Show older comments
Salim
on 28 Apr 2024
Commented: Manikanta Aditya
on 1 May 2024
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
0 Comments
Accepted Answer
Manikanta Aditya
on 28 Apr 2024
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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!