App Designer uiaxes in tab group stops working after computer goes to sleep

I'm writing a program that generates a waveform and then displays the waveform and its spectrum in a plot that is inside a double nested tab group. Initially, the plot was working fine, but whenever my computer goes to sleep, restarts, or goes on standby, the three axes that are inside the double nested tab group stop plotting (even though I haven't edited any code). I'm fairly certain this is a bug with app designer since I can fix the problem by deleting the axes components and inserting new ones. Obviously, this is less than ideal. I searched my problem before asking this and found this thread with the same problem but no solution. Has anyone had this problem/found a workaround?

2 Comments

Could you tell me which version of MATLAB you are using and also could you share any sample code which leads to this?
I am using MATLAB R2017b. It should be noted that UIAxes3, UIAxes4, and UIAxes5 are all inside a tab group (from appdesigner), each axis in its own tab.
Here is some sample code:
ax3 = app.UIAxes3;
ax4 = app.UIAxes4;
ax5 = app.UIAxes5;
plot(ax3,time,zGen{1}*100,'r')
title(ax3,'Wave Height vs. Time');
ylabel(ax3,'Wave Height (cm)');
xlabel(ax3,'Time (s)');
cla(ax4);
plot(ax4,fzGen,SzSG{1},'g')
app.UIAxes4.XLim = xlimit(:);
hold(ax4,'on');
plot(ax4,freq,SGen,'r');
title(ax4,'Power Spectrum')
legend(ax4,'Produced Spectrum','Theoretical Spectrum');
xlabel(ax4,'Frequency [Hz]');
ylabel(ax4,'Amplitude');
app.UIAxes5.XLim = xlimit(:);
cla(app.UIAxes5);
plot(app.UIAxes5,fzGen,aggregateS,'g') %IF PLOTTING STOPS WORKING FOR NO REASON, DELETE AND RE-ADD AXES
hold(app.UIAxes5,'on');
plot(app.UIAxes5,freq,SGen,'r');
title(ax5,'Average of All Waveform Sets')
legend(app.UIAxes5,'Produced Spectrum','Theoretical Spectrum');
xlabel(ax5,'Frequency [Hz]');
ylabel(ax5,'Amplitude');
Also, here is some relevant grayed out code that appdesigner produced:
% Create TabGroup2
app.TabGroup2 = uitabgroup(app.WaveGenerationTab);
app.TabGroup2.Position = [319 1 421 288];
% Create WaveformTab
app.WaveformTab = uitab(app.TabGroup2);
app.WaveformTab.Title = 'Waveform';
% Create UIAxes3
app.UIAxes3 = uiaxes(app.WaveformTab);
title(app.UIAxes3, 'Title')
xlabel(app.UIAxes3, 'X')
ylabel(app.UIAxes3, 'Y')
app.UIAxes3.DataAspectRatio = [1 1 1];
app.UIAxes3.PlotBoxAspectRatio = [1 1 1];
app.UIAxes3.XLim = [0 1];
app.UIAxes3.YLim = [0 1];
app.UIAxes3.ZLim = [0 1];
app.UIAxes3.CLim = [0 1];
app.UIAxes3.GridColor = [0.15 0.15 0.15];
app.UIAxes3.MinorGridColor = [0.1 0.1 0.1];
app.UIAxes3.XColor = [0.15 0.15 0.15];
app.UIAxes3.XTick = [0 0.2 0.4 0.6 0.8 1];
app.UIAxes3.YColor = [0.15 0.15 0.15];
app.UIAxes3.YTick = [0 0.2 0.4 0.6 0.8 1];
app.UIAxes3.ZColor = [0.15 0.15 0.15];
app.UIAxes3.ZTick = [0 0.5 1];
app.UIAxes3.CameraPosition = [0.5 0.5 9.16025403784439];
app.UIAxes3.CameraTarget = [0.5 0.5 0.5];
app.UIAxes3.CameraUpVector = [0 1 0];
app.UIAxes3.Position = [5 1 415 260];
% Create SpectrumTab
app.SpectrumTab = uitab(app.TabGroup2);
app.SpectrumTab.Title = 'Spectrum';
% Create UIAxes4
app.UIAxes4 = uiaxes(app.SpectrumTab);
title(app.UIAxes4, 'Title')
xlabel(app.UIAxes4, 'X')
ylabel(app.UIAxes4, 'Y')
app.UIAxes4.DataAspectRatio = [1 1 1];
app.UIAxes4.PlotBoxAspectRatio = [1 1 1];
app.UIAxes4.XLim = [0 1];
app.UIAxes4.YLim = [0 1];
app.UIAxes4.ZLim = [0 1];
app.UIAxes4.CLim = [0 1];
app.UIAxes4.GridColor = [0.15 0.15 0.15];
app.UIAxes4.MinorGridColor = [0.1 0.1 0.1];
app.UIAxes4.XColor = [0.15 0.15 0.15];
app.UIAxes4.XTick = [0 0.2 0.4 0.6 0.8 1];
app.UIAxes4.YColor = [0.15 0.15 0.15];
app.UIAxes4.YTick = [0 0.2 0.4 0.6 0.8 1];
app.UIAxes4.ZColor = [0.15 0.15 0.15];
app.UIAxes4.ZTick = [0 0.5 1];
app.UIAxes4.CameraPosition = [0.5 0.5 9.16025403784439];
app.UIAxes4.CameraTarget = [0.5 0.5 0.5];
app.UIAxes4.CameraUpVector = [0 1 0];
app.UIAxes4.Position = [5 1 415 260];
% Create AvgSpectrumofAllWavesTab
app.AvgSpectrumofAllWavesTab = uitab(app.TabGroup2);
app.AvgSpectrumofAllWavesTab.Title = 'Avg. Spectrum of All Waves';
% Create UIAxes5
app.UIAxes5 = uiaxes(app.AvgSpectrumofAllWavesTab);
title(app.UIAxes5, 'Title')
xlabel(app.UIAxes5, 'X')
ylabel(app.UIAxes5, 'Y')
app.UIAxes5.DataAspectRatio = [1 1 1];
app.UIAxes5.PlotBoxAspectRatio = [1 1 1];
app.UIAxes5.XLim = [0 1];
app.UIAxes5.YLim = [0 1];
app.UIAxes5.ZLim = [0 1];
app.UIAxes5.CLim = [0 1];
app.UIAxes5.GridColor = [0.15 0.15 0.15];
app.UIAxes5.MinorGridColor = [0.1 0.1 0.1];
app.UIAxes5.XColor = [0.15 0.15 0.15];
app.UIAxes5.XTick = [0 0.2 0.4 0.6 0.8 1];
app.UIAxes5.YColor = [0.15 0.15 0.15];
app.UIAxes5.YTick = [0 0.2 0.4 0.6 0.8 1];
app.UIAxes5.ZColor = [0.15 0.15 0.15];
app.UIAxes5.ZTick = [0 0.5 1];
app.UIAxes5.CameraPosition = [0.5 0.5 9.16025403784439];
app.UIAxes5.CameraTarget = [0.5 0.5 0.5];
app.UIAxes5.CameraUpVector = [0 1 0];
app.UIAxes5.Position = [5 1 415 260];

Sign in to comment.

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products

Release

R2017b

Asked:

on 8 Jun 2018

Commented:

on 25 Jun 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!