Surf plot: Data dimensions must agree.
2 views (last 30 days)
Show older comments
Can't for the life of me figure this out..
trying to plot the following:
surf(transect1.lon,transect1.lat,transect1.z,transect1.u)
They have the following dimensions:
size(transect1.lon) = 29 1
size(transect1.lat) = 29 1
size(transect1.z) = 29 30
size(transect1.u) = 29 30
0 Comments
Accepted Answer
Star Strider
on 5 Nov 2017
Either ‘transect1.lon’ or ‘transect1.lat’ has to be (30x1), or you have to remove one column from ‘transect1.z’ and ‘transect1.u’ so the dimensions match. (An option is to interpolate the matrices to make them both (29x29), or interpolate one of the vectors to (30x1).)
The surface plots only take one matrix argument, so you have to use hold to plot both in the same axes.
After you make sure the vectors and matrix dimensions match, see if this does what you want:
figure
surf(transect1.lon,transect1.lat,transect1.z)
hold on
surf(transect1.lon,transect1.lat,transect1.u)
hold off
grid on
NOTE — I can’t run your code to test this, so this is UNTESTED CODE.
0 Comments
More Answers (0)
See Also
Categories
Find more on Surface and Mesh 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!