Problem 1120. Visualization of experimental data across a surface
Assume that you have taken data across the surface of a sample, for example sheet resistance. The data is stored in a Nx3 matrix, where the columns are: [X,Y,data]. Assume that the lower-left corner of the sample is (X,Y) = (0,0), and the upper right corner of the sample is (X,Y) = (3,3), and the data is taken only at integers between 0:3 (4x4 or max of 16 locations across the sample).
The goal is to find the simplest way to take the data and construct a 2-dimensional matrix, where the data at (0,0) is in the lower-left and the data at (3,3) is in the upper right. Any locations with no data specified should end up as NaN in the final matrix. If any location is listed twice in the data, the LAST value (the one with the highest row index) should be used. It is possible that there is no data (i.e. data = []);
For example, if the input data is:
data = [ 0 0 5 1 1 2 2 2 7 3 3 8 1 1 6 ];
Then the output should be:
output = [ NaN NaN NaN 8 NaN NaN 7 NaN NaN 6 NaN NaN 5 NaN NaN NaN ];
Solution Stats
Problem Comments
-
1 Comment
I had no idea that the function isequalwithequalnans exists. That makes me wonder how many functional variants of isequal exist.
Solution Comments
Show commentsProblem Recent Solvers38
Suggested Problems
-
Back to basics 25 - Valid variable names
324 Solvers
-
707 Solvers
-
339 Solvers
-
Rounding off numbers to n decimals
4525 Solvers
-
4675 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!