How to Import Vectors in AppDesigner

7 ビュー (過去 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 Center および File ExchangeDevelop 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