How to change the size of a matrix by filling with nan's?
12 views (last 30 days)
Show older comments
Hello
I have x, y and z matrices relating to lat,long and depth of bathymetric surveys. I have this data for several years although each survey is in a slightly different position.
Therefore to make consistent plots and animations I need to first define one grid of x and y matrices which all the z matrices can relate to?
I am thinking if I take the smallest and largest eastings and northing from the x and y matrices and then create a new X and Y with these ranges I can use these to plot the different z values on however first I need to make z the same correct size but I want to do this by adding NaN's around the data so the survey area still remains unchanged but I can contour plot x,y,z and x,y,z1 and x,y,z2 etc... so that the coordinates are consistent.
I know this is not very clear but I am struggling to get my head round it at the moment! Any help would be much appreciated.
Thank you
3 Comments
Accepted Answer
Fangjun Jiang
on 28 Jun 2011
Preempt z with NaNs and then fill with data
z=nan(10,10)
z(2:6,3:7)=magic(5)
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!