data extraction for a specific period over a long data.
조회 수: 1 (최근 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
댓글 수: 0
채택된 답변
Manikanta Aditya
2024년 4월 28일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!