Order of code execution seems weird
2 ビュー (過去 30 日間)
古いコメントを表示
I have built an app that executes long functions. In my GUI I have something like a MessageWindow (Colored-Edit-Field). When clicking a button to calculate something that takes a while I want to show a Message like: "LOADING. . ." The according code is shown below.
When I execute the code by clicking the button, the Message is not shown. The calculation function ist executed though.
When I step through my code with the debugger line by line, it works fine. So for me it seems like MATLAB ist not executing the code in the correct order. Can somone explain me what the problem could be here?
%% Function in app.PlotSetup
function printProcess(app, message)
app.StatusEditField.BackgroundColor = app.yellow;
app.StatusEditField.Value = message;
end
%% Code in app.Plotting
% Function to show message
printProcess(app.PlotSetup, "LOADING WITH SELECTED PARAMETERS...")
% Big calculation function
continueImportProcess(app.PlotSetup)
1 件のコメント
Jon
2023 年 11 月 16 日
Would it be possible for you to make a self contained example that reproduces the problem and attach it?
採用された回答
Stephen23
2023 年 11 月 16 日
移動済み: Image Analyst
2023 年 11 月 16 日
Try calling DRAWNOW after setting the editfield values.
その他の回答 (1 件)
Bruno Luong
2023 年 11 月 16 日
%% Function in app.PlotSetup
function printProcess(app, message)
app.StatusEditField.BackgroundColor = app.yellow;
app.StatusEditField.Value = message;
drawnow % force GUI to refresh
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!