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
Solution Comments
Show commentsProblem Recent Solvers42
Suggested Problems
-
Find the sum of all the numbers of the input vector
54924 Solvers
-
4514 Solvers
-
Create a cell array out of a struct
2565 Solvers
-
Back to basics 22 - Rotate a matrix
938 Solvers
-
722 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!
I had no idea that the function isequalwithequalnans exists. That makes me wonder how many functional variants of isequal exist.