Hello, I have in app designer 6 TextField that create an ellipsoid and i converted with str2double but the ellispoid looks the same with any numbers.
properties (Access = private)
xc = []; xr = [];
yc = []; yr = [];
zc = []; zr = [];
n = [];
end
% Callbacks that handle component events
methods (Access = private)
% Value changed function: DesenareStergereCheckBox
function DesenareStergereCheckBoxValueChanged(app, event)
app.xc = app.xcEditField.Value;
app.yc = app.ycEditField.Value;
app.zc = app.zcEditField.Value;
app.xr = app.xrEditField.Value;
app.yr = app.yrEditField.Value;
app.zr = app.zrEditField.Value;
[X,Y,Z] = ellipsoid(str2double(app.xc), str2double(app.yc), str2double(app.zc), str2double(app.xr), str2double(app.yr), str2double(app.zr));
axis equal
if app.DesenareStergereCheckBox.Value
set(mesh(app.UIAxes,X,Y,Z),'visible','on')
else
set(mesh(app.UIAxes,X,Y,Z),'visible','off')
end
end

댓글 수: 9

They don't look the same to me. Look at the axis ranges. Also, the bottom one looks rounder to me, although that could simply be the data aspect.
You probably want to use the daspect function:
daspect([1 1 1])
HANZU OLIVIU-MIHAI
HANZU OLIVIU-MIHAI 2022년 1월 25일
The first one should look like this but with mesh
Rik
Rik 2022년 1월 25일
All three axis ranges are different between the surf you showed and the screenshot of AppDesigner. How am I supposed to tell the difference?
If you want static ranges for your axis you will have to set them explicitly.
HANZU OLIVIU-MIHAI
HANZU OLIVIU-MIHAI 2022년 1월 25일
How can I do that ?
doc xlim
doc ylim
doc zlim
Or even just simply with axis.
HANZU OLIVIU-MIHAI
HANZU OLIVIU-MIHAI 2022년 1월 25일
Did you know how can I change the number of faces from the slide var?
app.xc = app.xcEditField.Value;
app.yc = app.ycEditField.Value;
app.zc = app.zcEditField.Value;
app.xr = app.xrEditField.Value;
app.yr = app.yrEditField.Value;
app.zr = app.zrEditField.Value;
app.n = app.nSlider.Value; % <-- use whatever your slider is called instead of "nSlider" here
[X,Y,Z] = ellipsoid( ...
str2double(app.xc), ...
str2double(app.yc), ...
str2double(app.zc), ...
str2double(app.xr), ...
str2double(app.yr), ...
str2double(app.zr), ...
app.n);
HANZU OLIVIU-MIHAI
HANZU OLIVIU-MIHAI 2022년 1월 25일
I get this error after writing the code
Voss
Voss 2022년 1월 25일
편집: Voss 2022년 1월 25일
I guess you have to convert n to a number first (apparently contradicting the documentation for uislider(), which states that Value is numeric - who knows, maybe that's not a uislider() you have there at all, there is no way for me to know):
app.xc = app.xcEditField.Value;
app.yc = app.ycEditField.Value;
app.zc = app.zcEditField.Value;
app.xr = app.xrEditField.Value;
app.yr = app.yrEditField.Value;
app.zr = app.zrEditField.Value;
app.n = app.nSlider.Value; % <-- use whatever your slider is called instead of "nSlider" here
[X,Y,Z] = ellipsoid( ...
str2double(app.xc), ...
str2double(app.yc), ...
str2double(app.zc), ...
str2double(app.xr), ...
str2double(app.yr), ...
str2double(app.zr), ...
str2double(app.n));

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Labels and Annotations에 대해 자세히 알아보기

태그

질문:

2022년 1월 25일

편집:

2022년 1월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by