App Designer input arguments
9 views (last 30 days)
Show older comments
Hi,
I am using the App Designer for the first time (MatLab 2019a) and I am strugging with a basic problem - I am using a script where I create some variables and call the app. I want to use the variable from the workspace inside the app. I tried to use it as an app Input Argument but in many ways, it does not work. My code is below (the app). The error message I am getting is 'Cannot run with provided input arguments. Caused by: Not enough input arguments.' Can someone tell me what I am doing wrong?
classdef Experiment_app1 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
PLAYButton matlab.ui.control.Button
HvorhjtEditFieldLabel matlab.ui.control.Label
HvorhjtEditField matlab.ui.control.NumericEditField
Image matlab.ui.control.Image
Loudnessscalingexperimentnoise1Label matlab.ui.control.Label
NextButton matlab.ui.control.Button
end
properties (Access = private)
data
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app, noise1)
Experiment_app1.data = load('CI_loudness_experiment_2.mat', noise1)
end
% Button pushed function: PLAYButton
function PLAYButtonPushed(app, event)
sound(noise1(:,1),Fs)
end
3 Comments
Adam
on 6 Aug 2019
But the whole point of this was to have input arguments wasn't it? Yet you are calling it without passing in that input argument! Pass in whatever 'noise1' should be.
Answers (1)
Harsha Priya Daggubati
on 8 Aug 2019
Hi,
I assume that your mat file ‘CI_loudness_eperiment_2’ contains a variable named ‘noise1’. The approach you are following seems correct as per my knowledge. I suggest debug through the code with breakpoints and make sure whether the data loads as intended. If the problem persists, I ask to properly attach the error messages you are getting.
0 Comments
See Also
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!