Borrar filtros
Borrar filtros

How to Import Vectors in AppDesigner

5 visualizaciones (últimos 30 días)
Francesco Carraro
Francesco Carraro el 27 de Feb. de 2020
Comentada: Adam el 27 de Feb. de 2020
Hello everyone,
I need to import a Matlab data File in a script made with Appdesigner, and plot the vectors, but I can't load properly the file.
I have to use the vectors that are storage in "('E:\UniPd\Motostudent\Dati\Prova_export_MATLAB.mat')" as variables 1/2. I've already tried to use 'load' function but Matlab gives me error. Here it is a part of the script:
classdef App_Telemetry_1 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
UIAxes matlab.ui.control.UIAxes
UIAxes2 matlab.ui.control.UIAxes
Slider matlab.ui.control.Slider
UIAxes3 matlab.ui.control.UIAxes
ThrottleTextAreaLabel matlab.ui.control.Label
ThrottleTextArea matlab.ui.control.TextArea
BrakeTextAreaLabel matlab.ui.control.Label
BrakeTextArea matlab.ui.control.TextArea
LeanAngleTextAreaLabel matlab.ui.control.Label
LeanAngleTextArea matlab.ui.control.TextArea
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [0 0 1280 720];
app.UIFigure.Name = 'UI Figure';
% Create Telemetry Data Portion Plot
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, 'Data Portion')
xlabel(app.UIAxes, '')
ylabel(app.UIAxes, '')
app.UIAxes.Position = [1 298 751 421];
%time= variable 1
%y1 = variable 2
plot(app.UIAxes,time,y1,'r');
  1 comentario
Adam
Adam el 27 de Feb. de 2020
Use the form of load which returns a structure as output (which is recommended in any case) rather than just dumping the variables into the workspace as a regular call to load will do.
doc load

Iniciar sesión para comentar.

Respuestas (1)

Emerson Nithiyaraj
Emerson Nithiyaraj el 27 de Feb. de 2020
If loading the data file is the only problem, check whether the data file is present in your current working directory.
  1 comentario
Francesco Carraro
Francesco Carraro el 27 de Feb. de 2020
Yes I've already checked and the file is there; this is the error that Matlab shows
>> App_Telemetry_1
Error using load
Attempt to add "L003_time" to a static workspace.
See Variables in Nested and Anonymous Functions.
Error in App_Telemetry_1/createComponents (line 40)
load('E:\UniPd\Motostudent\Dati\Prova_export_MATLAB.mat');

Iniciar sesión para comentar.

Categorías

Más información sobre Develop uifigure-Based Apps en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by