For large datasets this allows much faster plotting.
An irregular 2D spatial sampling is provided in x and y vectors with a data point to plot in vector d. A bin size is also provded in vector b=[dx,dy]
Return a 2D matrix M with minimal empty cells with the correct spatial relationship of d and last value only retained in the event of duplicates.
Example
b = [6,9];
x = rand(3333,1)*100*b(1)+1500;
y = rand(3333,1)*100*b(2)+50000;
d = sind(sqrt(x.^2+y.^2))./sqrt(x.^2+y.^2);
Return G, a 2D matrix with d binned in rows and columns
Solution Stats
Problem Comments
5 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers5
Suggested Problems
-
Determine whether a vector is monotonically increasing
22846 Solvers
-
Remove any row in which a NaN appears
8768 Solvers
-
English to Pig Latin Translator
159 Solvers
-
Getting the row and column location from a matrix
297 Solvers
-
Numbers spiral diagonals (Part 2)
196 Solvers
More from this Author11
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
I think the test suite is wrong:
If "G" is supposed to have a "minimal number of empty cells" then why is the second test a 9x9 with the last column being all zeros? I would expect this column to be unnecessary.
For the first test, I'm getting 1.2690e-05 for chk2.
Problem is great though!
Sean, I agree, my bad, I removed the end column and rescored. my code yields 1.2680e-05 still (last value kept per cell?)
The function roundn is no longer supported by Cody, please update the test suite to round(x/10^e)*10^e.
The test suite has been fixed as requested by Rafael S.T. Vieira.
Thanks, goc3. Now the problem is working again. :)