How do I close all Biograph Viewers programmatically in MATLAB 7.8 (R2009a)?

3 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 13 Jul 2009
The creation of a Biograph Viewer through the view command does not return the figure handle necessary to use the close function.
To close the Biograph Viewer programatically it's necessary to find the handles to the figures that are currently open and then use a string comparison to find those with 'Biograph Viewer' in the first 15 characters of the 'Name' properties.
The following code closes all the open Biograph Viewers leaving all others figures open:
% The following creates a biograph
W = [.41 .99 .51 .32 .15 .45 .38 .32 .36 .29 .21];
DG = sparse([6 1 2 2 3 4 4 5 5 6 1],[2 6 3 5 4 1 6 3 4 3 5],W);
view(biograph(DG));
% This finds handles to all the objects in the current session, filters it to find just the handles to the Biograph Viewers so that they can be selectively closed.
child_handles = allchild(0);
names = get(child_handles,'Name');
k = find(strncmp('Biograph Viewer', names, 15));
close(child_handles(k))

More Answers (0)

Categories

Find more on Genomics and Next Generation Sequencing in Help Center and File Exchange

Products


Release

R2009a

Community Treasure Hunt

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

Start Hunting!