3D scale bar for mesh/surf?

I can't seem to find s scale-bar-making function in MATLAB. I need it for a mesh that I made with dimensions in millimeters. Can anyone help me with this please? I want it to be something like this:

Réponses (1)

Mike Garrity
Mike Garrity le 15 Avr 2015
Modifié(e) : Mike Garrity le 15 Avr 2015

0 votes

You could start with something like this:
function scalebar(xc,yc,zc, w, label)
x = [xc, xc-w, nan, xc, xc , nan, xc, xc ];
y = [yc, yc , nan, yc, yc-w, nan, yc, yc ];
z = [zc, zc , nan, zc, zc , nan, zc, zc+w];
hl = line(x,y,z);
hl.LineWidth = 2;
ht = text(xc,yc,zc,[num2str(w), ' ', units]);
ht.FontSize = 18;
ht.Color = hl.Color;
ht.VerticalAlignment = 'bottom';
The nans are to insert breaks in between the individual line segments.
I can use it like this:
[x,y,z]=peaks;
surf(x,y,z)
scalebar(-.1,1.4,8.5, 2, 'Feet')
to get this:
%

Catégories

En savoir plus sur Discrete Data Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by