Calling appdesigner within a function leads to unrecognized function or variable
显示 更早的评论
Hello everyone,
I am desperately looking for a solution. I call up an app within a function. The variables are created within the function and passed as input to the app.
function RunSim(A,B)
% Parameter
TestCase = 'TBD';
Date = 'TBD';
% Call App
App_Example = App_Name(TestCase,Date)
waitfor(App_Example)
% I need A,B,TestCase,Date for the further calculations within this function.
end
The next step are adjustments made via the GUI and these adjustments are loaded back into the workspace from the function. As I have a refresh button, I want to reload the list after the change has been made.
function startupFcn(app,TestCase,Date)
%% Read List_TestCases.xlsx
% The values can be modified in the excel TestCases.xlsx
% Expand List_TestCase
if length(TestCase(1,:)) < 6
TestCase(1,6) = {'ID'};
%Transfer to function workspace
assignin("caller","temp",List_TestCases);
evalin("caller","List_TestCases = temp;");
end
TestCase = evalin("caller","TestCase;"); % Unrecognized function or variable 'TestCase'.
end
Here the error occurs that during the refresh, when the function startupFcn is executed again, the variable can no longer be found. Unfortunately I can't find a solution, it works if the app is not accessed within a function (direct via script), but I have to access the app within this function.
I thank you in advance.
采纳的回答
更多回答(1 个)
Benjamin Kraus
2022-5-2
0 个投票
There is no straightforward way to assign outputs from an App Designer app. I found a few other discussions on this topic on MATLAB Answers already:
- Output arguments in App Designer
- How can I work around the fact that app designer does not support output arguments?
The second one has some workarounds that might satisfy your needs.
类别
在 帮助中心 和 File Exchange 中查找有关 Manage Products 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!