How to make plot change as I move the slider? How to import these values from excel file?

2 visualizaciones (últimos 30 días)
I would like to make an app that will allow me to plot some values from an excel sheet and as I move the slider it will keep changing. So, if I have an X value of 1 and a Y value of 2 at slider time 1 I want to show that and if I have an X value of 2 and Y value of 3 at slider time 2 then I want to show that at that given time.
classdef app1 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
forcegraph matlab.ui.control.UIAxes
Importgraphvalues matlab.ui.control.Button
TimeSliderLabel matlab.ui.control.Label
TimeSlider matlab.ui.control.Slider
end
methods (Access = private)
% Value changed function: TimeSlider
function TimeSliderValueChanged(app, event)
end
end
% App initialization and construction
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure
app.UIFigure = uifigure;
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'UI Figure';
% Create forcegraph
app.forcegraph = uiaxes(app.UIFigure);
title(app.forcegraph, 'Force vs Cars')
xlabel(app.forcegraph, 'Cars')
ylabel(app.forcegraph, 'Force')
app.forcegraph.Position = [2 108 640 373];
% Create Importgraphvalues
app.Importgraphvalues = uibutton(app.UIFigure, 'push');
app.Importgraphvalues.Position = [261 12 122 22];
app.Importgraphvalues.Text = 'Import graph values';
% Create TimeSliderLabel
app.TimeSliderLabel = uilabel(app.UIFigure);
app.TimeSliderLabel.HorizontalAlignment = 'right';
app.TimeSliderLabel.Position = [1 81 32 15];
app.TimeSliderLabel.Text = 'Time';
% Create TimeSlider
app.TimeSlider = uislider(app.UIFigure);
app.TimeSlider.Limits = [0 2000];
app.TimeSlider.MajorTicks = [0 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000];
app.TimeSlider.ValueChangedFcn = createCallbackFcn(app, @TimeSliderValueChanged, true);
app.TimeSlider.Position = [53.6875 87 568 3];
end
end
methods (Access = public)
% Construct app
function app = app1
% Create and configure components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end
  3 comentarios

Iniciar sesión para comentar.

Respuesta aceptada

Kevin Holly
Kevin Holly el 22 de Jul. de 2022
Please see the app attached.
  7 comentarios

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by