Reorganize column-data and fill empty cells with zeros

Hallo everyone!
I have a 379x3 matrix, with Lat & Long data in the first two columns and measured data in the third column.
I want to efficiently reconstruct these three columns to a Lat x Long x Data construct... Latitude in the first column, Longitude in the first row and the corresponding measured data distributed to the correct cells where empty cells are filled with a zero.
How can I do this in an elegant way?
Thanks already! M

 Accepted Answer

Okay, I figured it out! I'm using vec2mtx first to create a grid and then fill the grid with imbedm.
Example:
latlim = [-34 -32];
lonlim = [-70 -68];
[Grid, R] = vec2mtx(lat_s, long_s, 100, latlim, lonlim);
Grid = imbedm(lat_s, long_s, Pb_s, Grid, R);
%I don't know why, but some values are still ones. So I need to convert them to zeros
Grid(Grid == 1) = 0;
Now I have the data grid I want and adding the Lat/Long values in the first column and row is simple.

More Answers (0)

Products

Asked:

on 9 Aug 2017

Edited:

on 10 Aug 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!