Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
Tomaszzz
Tomaszzz am 30 Mai 2023
Beantwortet: Jon am 30 Mai 2023
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.

Akzeptierte Antwort

Jon
Jon am 30 Mai 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

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by