Trying to create a button that Calculates and displays both sine and cosine of the angle. in app designer

2 次查看(过去 30 天)
I'm trying to use the yc and ys fuctions to create a plot and display they're values in a text box.
% Button pushed function: ConfirmtheanswerButton
function ConfirmtheanswerButtonPushed(app, event)
degrees = app.EnterDegreesEditField.Value;
% creates the variable for degrees.
radians = degrees.*pi./180;
% Converts degrees to radians.
yc = cos(radians);
ys = sin(radians);
plot(app.UIAxes,yc);
plot(app.UIAxes_2,ys);
c = yc.^2 + ys.^2;
% Confirms that the radians from degrees conversion is correct
app.ConfirmationoftheanswerEditField.Value = c;
% sets the variable for the formula.
end
% Button pushed function: PlotSinCosButton
function PlotSinCosButtonPushed(app, event)
degrees = app.EnterDegreesEditField.Value;
% creates the variable for degrees.
radians = degrees.*pi./180;
% Converts degrees to radians.
yc = cos(radians);
ys = sin(radians);
plot(app.UIAxes,yc,'+');
plot(app.UIAxes_2,ys,'+');
yc = app.CosineoftheangleEditField.ValueDisplayFormat;
ys = app.SineoftheangleEditField.Value;
end
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by