MATLAB: Does the app freeze when loading data to a Table in App Designer and MATLAB R2017b

MATLAB

Why does my app freeze when loading data to a Table in App Designer and MATLAB R2017b?
I have an app with 2 tables. When I load some data to the table in "startupFcn", the app freezes with loading graphic showing in the Table. Below is some code within the "startupFcn" function that causes the freeze:
>> app.StartButton.UserData='stopped';
>>
>> view(app.AnimAxes, 30,2)
>>
>> LoadData(app);
>> app.Brake_Table.Data(:,1) = app.Data11;
>> app.Brake_Table.Data(:,2) = app.Data12;
>> app.Brake_Table_2.Data(:,1) = app.Data21;
>> app.Brake_Table_2.Data(:,2) = app.Data22;
>>
>> app.ax_Carposplot.XLim = [0 10];
>> app.ax_Carvplot.XLim = [0 10];
>> app.ax_Caraplot.XLim = [0 10];
>> app.ax_SCplot.XLim = [0 10];
>> app.ax_SCplot.YLim = [-0.2 1.2];
>> app.ax_SCplot.YTick = [0 1];
>> app.ax_SCplot.YTickLabel = {'open', 'closed'};
I have to "ctrl-c" App Designer to force it to stop. Then I will get the following error message in Command Window after App Designer stops:
Error using drawnow
Operation terminated by user
Error in appdesigner.internal.model.AppModel.runAppHelper (line 628)
drawnow;
Error in
appdesigner.internal.model.AppModel>@()appdesigner.internal.model.AppModel.runAppHelper(obj,appArguments)
(line 400)
funcHandle = @()appdesigner.internal.model.AppModel.runAppHelper(obj,

Best Answer

This issue does not occur in MATLAB R2018a.
To workaround this issue in MATLAB R2017b, add some "pause" statements:
>> app.StartButton.UserData='stopped';
>> pause(1);
>> view(app.AnimAxes, 30,2)
>> pause(1);
>>
>> LoadData(app);
>> pause(1);
>> app.Brake_Table.Data(:,1) = app.Data11;
>> app.Brake_Table.Data(:,2) = app.Data12;
>> pause(1);
>> app.Brake_Table_2.Data(:,1) = app.Data21;
>> app.Brake_Table_2.Data(:,2) = app.Data22;
>> pause(1);
>>
>> app.ax_Carposplot.XLim = [0 10];
>> app.ax_Carvplot.XLim = [0 10];
>> app.ax_Caraplot.XLim = [0 10];
>> app.ax_SCplot.XLim = [0 10];
>> app.ax_SCplot.YLim = [-0.2 1.2];
>> app.ax_SCplot.YTick = [0 1];
>> app.ax_SCplot.YTickLabel = {'open', 'closed'};