How to update titles and text annotations of subplots located on the same uitab?

2 views (last 30 days)
% TAB 1
S.tabH(1) = uitab(S.histoTab, 'Title', 'Error X');
S.P1_histo{1} = subplot(2,2,[1 3], 'Parent', S.tabH(1));
s2.tab1sp1 = hggroup;
S.P1_histo{2} = subplot(2,2,[2 4], 'Parent', S.tabH(1));
s2.tab1sp2 = hggroup;
% TAB 2
S.tabH(2) = uitab(S.histoTab, 'Title', 'Error Y');
S.P2_histo{1} = subplot(2,2,[1 3], 'Parent', S.tabH(2));
title('On Fly');
s2.tab2sp1 = hggroup;
S.P2_histo{2} = subplot(2,2,[2,4], 'Parent', S.tabH(2));
title('Static');
s2.tab2sp2 = hggroup;
%%In the Callback Function
handles = guidata(source);
currentTab = find(source.SelectedTab == S.tabH);
switch currentTab
case 1
if ~isempty(handles.R_Site_X_Static_NM_DRF)
histogram(handles.R_Site_X_Static_NM_DRF, 'parent',s2.tab1sp2);
ThreeSig_X_S = 3 * std(handles.R_Site_X_Static_NM_DRF);
stringH1 = strcat({'Static, '},{'3sig: '}, {num2str(ThreeSig_X_S)});
title(S.P1_histo{1}, 'Static');
text(S.P1_histo{1},0, 200, stringH1);
end
if ~isempty(handles.R_Site_X_OnFly_NM_DRF)
histogram(handles.R_Site_X_OnFly_NM_DRF, 'parent', s2.tab1sp1);
ThreeSig_X_OF = round(3 * std(handles.R_Site_X_OnFly_NM_DRF),3);
stringH2 = strcat({'3sig: '}, {num2str(ThreeSig_X_OF)});
title(S.P1_histo{2}, 'On Fly');
text(S.P1_histo{2},0.2, 130, stringH2, 'FontWeight', 'Bold');
end
case 2
...
I am getting the title and text annotation only for the second subplot of tab 1. When debugging the code line by line, I get the title and text for the first subplot too, but it later disappears.

Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!