Convert form string to number
Mostra commenti meno recenti
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 Commenti
Rik
il 25 Gen 2022
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
il 25 Gen 2022
Rik
il 25 Gen 2022
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
il 25 Gen 2022
Rik
il 25 Gen 2022
doc xlim
doc ylim
doc zlim
Or even just simply with axis.
HANZU OLIVIU-MIHAI
il 25 Gen 2022
Voss
il 25 Gen 2022
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
il 25 Gen 2022
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));
Risposte (0)
Categorie
Scopri di più su Labels and Annotations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

