필터 지우기
필터 지우기

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

조회 수: 2 (최근 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 CenterFile Exchange에서 Develop 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