Calling appdesigner within a function leads to unrecognized function or variable
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (1)
Benjamin Kraus
el 2 de Mayo de 2022
0 votos
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.
1 comentario
Andre
el 3 de Mayo de 2022
Categorías
Más información sobre Manage Products en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!