How can I retrieve values from another matrix so I can do a quiver plot?

1 次查看(过去 30 天)
I wrote a program that reads .nc files from a folder and puts filename, longitude, latitude, u(east component) and v(North Component) velocities into one structure. Each of them have their own matrix but they are related. For one file in the workspace it shows:
  • Latitude= 140x1 single
  • Longitude= 171x1 single
  • u= 171x140
  • v= 171x140
so it's almost like a graph, where latitude is the x values and longitude are the y values. The problem I'm having is that there are NaN for many of the u and v values. I want to have a separate structure with u and v values that are not NaN, and their respective Longitude and Latitude values. I was thinking that I would somehow go through every element and pick out the integers. After that I need to find out where it was in the structure. That way I can use where it was to find where to look at in the Latitude and Longitude structure. For example I have something like this in a structure (random numbers): look at txt file attached.
I want to do a quiver/velocity plot, so the corresponding points would look like x,y,u,v= 20,34,-.4,.7. These plots have a lot of data points, but I do not know how to get the respective Longitudes and Latitudes from the structures that correspond with the u and v to plot them. The example above is how I organized it in my code. Thanks!

采纳的回答

KSSV
KSSV 2016-10-28
Let x, y be your longitude and latitude data.
[X,Y] = meshgrid(x,y) ;
quiver(X,Y,u,v) ;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by