Trying to create a button that Calculates and displays both sine and cosine of the angle. in app designer
조회 수: 4 (최근 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
댓글 수: 1
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!