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

2 visualizaciones (últimos 30 días)
Tomaszzz
Tomaszzz el 30 de Mayo de 2023
Respondida: Jon el 30 de Mayo de 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.

Respuesta aceptada

Jon
Jon el 30 de Mayo de 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

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by