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

3 ビュー (過去 30 日間)
Tomaszzz
Tomaszzz 2023 年 5 月 30 日
回答済み: Jon 2023 年 5 月 30 日
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.

採用された回答

Jon
Jon 2023 年 5 月 30 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by