How to Import Vectors in AppDesigner

조회 수: 4 (최근 30일)
Francesco Carraro
Francesco Carraro 2020년 2월 27일
댓글: Adam 2020년 2월 27일
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
Adam
Adam 2020년 2월 27일
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

댓글을 달려면 로그인하십시오.

답변 (1개)

Emerson Nithiyaraj
Emerson Nithiyaraj 2020년 2월 27일
If loading the data file is the only problem, check whether the data file is present in your current working directory.
  댓글 수: 1
Francesco Carraro
Francesco Carraro 2020년 2월 27일
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');

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by