How to use cell as an input argument in an App?

1 view (last 30 days)
Hi all,
I made a checkbox app that I intend to execute automatically in my script.
This is what I intend to do with the app. That is, if I tick any of the above, it will replace all vector values to nan in that particular cell.
% Callbacks that handle component events
methods (Access = private)
% Value changed function: RectusFemorisCheckBox
function RectusFemorisCheckBoxValueChanged(app, event)
value = app.RectusFemorisCheckBox.Value;
for i = 1:length(rec_fem_cycle)
rec_fem_cycle{i}=nan;
end
end
% Value changed function: VastusMedialisCheckBox
function VastusMedialisCheckBoxValueChanged(app, event)
value = app.VastusMedialisCheckBox.Value;
for i = 1:length(vas_med_cycle)
vas_med_cycle{i}=nan;
end
end
as above for each of the cells
However I get the following error. I suspect this is something to do with the fact that app does not recognize the cell (I do have these cells in my workspace though);
K>> ignore_noise
Unrecognized function or variable 'rec_fem_cycle'.
Error in ignore_noise/BicepsFemorisCheckBoxValueChanged (line 49)
for i = 1:length(rec_fem_cycle)
Error in matlab.apps.AppBase>@(source,event)executeCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event) (line 63)
newCallback = @(source, event)executeCallback(appdesigner.internal.service.AppManagementService.instance(), ...
Error while evaluating CheckBox PrivateValueChangedFcn.

Accepted Answer

Jon
Jon on 30 May 2023
You can add properties to your app and assign values to them, for example when the app is initialized. Then inside of your callbacks you can utilize these property values using the syntax, app.myProperty

More Answers (0)

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!