I created a ML GUI script similar to the following:
fig1 = figure; % Window for GUI
tbgp = uitabgroup(fig1); % Create a tab group for that window
t1 = uitab(tbgp, 'Title', 'tab1'); % Create first tab under 'tbgp'
t2 = uitab(tbgp, 'Title', 'tab2'); %Create 2nd tab under 'tbgp'
Now, I want to add 2 "interactive" axes/plots, each with different properties, in both of the tabs defined above. I can write code in the script, but I'd like to do this using a function defined in a separate file located on the same ML path(so that I can just call the function whenever I want a similar interactive plot on something. In this case, I want the plots on two different tabs).
<IN A SEPARATE FILE>
function showInteractivePlot( desiredTab ) axes(desiredTab); % Draw axes on the desired tab
pan(fig1); % I want to enable panning on the axes located on the 'desiredTab', which
% is itself located in fig1
end
In the end, I would like to do the following in my GUI script:
fig1 = figure; % Window for GUI tbgp = uitabgroup(fig1); % Create a tab group for that window t1 = uitab(tbgp, 'Title', 'tab1'); % Create first tab under 'tbgp' t2 = uitab(tbgp, 'Title', 'tab2'); %Create 2nd tab under 'tbgp' % Add interactive plot to t1
showInteractivePlot(t1); % Add interactive plot to t2
showInteractivePlot(t2);
Best Answer