It is easy to plot slices along a straight line plane (e.g. x=-50, and y=40 in the first figure) using the slice function.
[x,y,z]=meshgrid(-55:0.1:-25,30:0.1:60,1:1:150); slice(x,y,z,c,-50,40,[]); shading flat;
However, how can I get a slice along a curved plane (like the second figure)?

 Akzeptierte Antwort

uxsmfu
uxsmfu am 8 Nov. 2018

1 Stimme

After some digging, problem solved. I figured I should share the solution here.
The index terms (xd,yd,zd) need to be 2-D.
[yd,zd]=meshgrid(lat,depth);
[xd,zd]=meshgrid(lon,depth);
slice(x,y,z,c,xd,yd,zd);

1 Kommentar

Guillaume
Guillaume am 8 Nov. 2018
"After some digging, problem solved. I figured I should share the solution here. The index terms (xd,yd,zd) need to be 2-D."
Basically, what I already said a day earlier in my answer: "Just pass a matrix of location for your x and y slice location"
Sometimes, you wonder why bother answering questions...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Guillaume
Guillaume am 7 Nov. 2018

0 Stimmen

how can I get a slice along a curved plane
Just pass a matrix of location for your x and y slice location instead of fixed -50, 40. There's even an example in the documentation of slice

Kategorien

Mehr zu Graphics Performance finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 7 Nov. 2018

Kommentiert:

am 8 Nov. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by