How do I convert irregular lat/lon data from excel to a regular MATLAB grid for viewing as a contour plot?

4 visualizaciones (últimos 30 días)
Hey there... I have a large data set with 6 columns in excel ordered by lat/lon (in decimal degrees to 0.01) and other variables such as year, month and most importantly for my survey, trawler fishing time in decimal hours. I want to build a 0.01 by 0.01 degree grid in MATLAB and view density of fishing hours (values between 0 & 8 hrs) as a contour plot. I have limited experience with MATLAB, I can make a grid using meshgrid to the appropriate size (58 x 165 grid cells) and I have imported the excel column data as vectors and as an array. How do I transpose/convert my data to a grid? There are multiple entries in the data for some grid cells and none for others. Help would be greatly appreciated.

Respuestas (1)

Chad Greene
Chad Greene el 11 de Jun. de 2016
Try using gridfit.
However, a note which you may wish to consider or neglect, depending on the level of accuracy you need: Be aware that 1 degree of latitude is not the same distance along the ground as 1 degree of longitude. Depending on where you are, the effects of gridding under the assumption of equal distance can be negligible, or can become significant.
  1 comentario
Eoghan Daly
Eoghan Daly el 11 de Jun. de 2016
Editada: Eoghan Daly el 11 de Jun. de 2016
Thanks for the suggestion Chad. Unfortunately it doesn't seem to do what I want. It interpolates values where there is no data and for my project I need to have zero or NaN values where no fishing took place. I think my problem is an indexing one, where I need a piece of code to recognise and assign Z values from my data to a regular XY grid while combining multiple values if found for one XY point and assigning NaN where no entry exists for a given XY point. I can easily do it manually in excel except there are 75 K rows of data.

Iniciar sesión para comentar.

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by