Borrar filtros
Borrar filtros

How can i set the scale of each axis in GUI?

3 visualizaciones (últimos 30 días)
DIJESH
DIJESH el 3 de Jun. de 2014
Respondida: DIJESH el 4 de Jun. de 2014
promptg = {'Length (m): ','Breadth(m): ','Depth(m): ','Draft(m): ','Waterdepth(m): '};
titleg = 'General parameters of the vessel';
answerg = inputdlg(promptg,titleg);
l = str2num(answerg{1});
b = str2num(answerg{2});
d = str2num(answerg{3});
t = str2num(answerg{4});
h = str2num(answerg{5});
c1 = [l/2 b/2 d-t];
c2 = [-l/2 b/2 d-t];
c3 = [-l/2 -b/2 d-t];
c4 = [l/2 -b/2 d-t];
c5 = [l/2 b/2 -t];
c6 = [-l/2 b/2 -t];
c7 = [-l/2 -b/2 -t];
c8 = [l/2 -b/2 -t];
f = figure('Visible','off','Position',[360,900,700,340]);
white = [1 1 1];
blue = [0 0 1];
red = [1 0 0];
green = [0 1 0];
set(gcf, 'Color', 0.95*white);
set(f,'Name','Simple GUI')
movegui(f,'center')
set(f,'Visible','on');
clf
ha = axes('Units','Pixels','Position',[200,60,200,185],'Color', 0.95*white);
gray =0.7*white;
x = [c1(1) c2(1) c3(1) c4(1)];
y = [c1(2) c2(2) c3(2) c4(2)];
z = [c1(3) c2(3) c3(3) c4(3)];
fill3(x,y,z,red,'FaceAlpha',0.4)
hold on
z = [c5(3) c6(3) c7(3) c8(3)];
fill3(x,y,z,red)
y = [c2(2) c6(2) c7(2) c3(2)];
z = [c2(3) c6(3) c7(3) c3(3)];
x = [c2(1) c6(1) c7(1) c3(1)];
fill3(x,y,z,red)
hold on
x = [c1(1) c5(1) c8(1) c4(1)];
fill3(x,y,z,red)
z = [c3(3) c7(3) c8(3) c4(3)];
x = [c3(1) c7(1) c8(1) c4(1)];
y = [c3(2) c7(2) c8(2) c4(2)];
fill3(x,y,z,red)
hold on
y = [c1(2) c2(2) c6(2) c5(2)];
fill3(x,y,z,red)
x = [c1(1)+250 c2(1)-250 c3(1)-250 c4(1)+250];
y = [c1(2)+250 c2(2)+250 c3(2)-250 c4(2)-250];
z = [0 0 0 0];
fill3(x,y,z,blue,'FaceAlpha',0.4)
If you run this code you can see that in the GUI formed..the scaling of z axis is different. how can i scale all three axes equally? or how can i set the scale of each axis?

Respuesta aceptada

DIJESH
DIJESH el 4 de Jun. de 2014
set(gca,'XLim',[-200 200],'YLim',[-200 200],'ZLim',[-200 200])
You just have to insert this command. The scale will set.

Más respuestas (0)

Categorías

Más información sobre Line 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