I am looking at running a moving window over a grid, incrementally shifting
along rows and columns, to allow processing within a window, with output
appended to a file (e.g. some mathematical function)
Can the code below be adapted for such processing:
// START OF CODE
n = 100;
m = 20; // moving window size
// function f can be anything but must operate on columns of input x
y = mean(x,'c');
// Initial loop solution:
y = rand(1,n);
y1 = zeros(1,n-m+1);
I have a grid with has nx_cols=120 and ny_rows=120, and I want to run say a
10x10 window, shifting 5 units (rows and columns for overlaps) over the
whole grid and calculate within each window. I am assuming that one has to
do this via indexing rows and columns respectively. Hopefully this can be
What type of function you need to evaluate at each patch?
How long does it take to run with the simplest double-loop implementation?
Your problem seems to have only 24 x 24 = 576 iterations ...
users mailing list
[hidden email] http://lists.scilab.org/mailman/listinfo/users
At the moment I am just looking to get a general methodology/script to test.
The real data grid is more like 1500x1500 or more.
The function could be anything really (e.g. z=f(x,y)), but ultimately I am
looking to run a radial averaged PSD from which one can extract depth to
magnetic sources (that's another story as they say!).
Not sure if that is any clearer. As I say, just looking for a general
structure to test, before jumping ahead.
I'm guessing it needs a nested for loop for rows and columns?
Thanks for the pointers, will look into the code further. With reference to the moving Window, I was thinking looping over rows and then the columns, not sure how Scilab works with a scan-line method, but will investigate.
Good to learn by trying!