Trying to plot the cosine of an angle in app designer
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm trying to create a button that displays values in two text boxs and plots two seperate graphs in the app designer so far the code I have is below. The program doesn't react when the button is pressed.
% 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.Value;
ys = app.SineoftheangleEditField.Value;
end
0 Kommentare
Antworten (1)
Ameer Hamza
am 21 Mai 2020
Bearbeitet: Ameer Hamza
am 21 Mai 2020
From your code, it appears that 'degrees' is a scalar
degrees = app.EnterDegreesEditField.Value;
so you are just trying to plot a single point. By default, it will not be visible on the axes. Change your lines to this
plot(app.UIAxes, yc, '+');
plot(app.UIAxes_2, ys, '+');
0 Kommentare
Siehe auch
Kategorien
Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!