Is there a way to change the active figure without making it visible?
Show older comments
Hi Everyone,
My Situation:
I am trying to use a MATLAB plot to generate a representation of a geometry I have. The Geometry consists of line segments that branch off of each other. To keep my indexing simplistic I use a single for loop to loop through the two arrays containing my segments. Each plot visualizes a different quantity on the same geometry.
Here is my code outline below:
function VesselPlot(Array1,Array2)
set(0,'DefaultFigureVisible','off')
fig1=figure('visible','off');
fig2=figure('visible','off');
for i = 1:length(Array1)
%Array 1
% create line coordinates for plot
startPoint=Array1(i).startpoint;
endPoint=Array1(i).endpoint;
x1 = [startPoint.x;endPoint.x];
y1 = [startPoint.y;endPoint.y];
z1 = [startPoint.z;endPoint.z];
%quantity 1
figure(fig1);
hold on
plot(x1,y1);
hold off
% quantitiy 2
figure(fig2);
hold on
plot(x1,y1);
hold off
% Array 2
% create line coordinates for plot
startPoint=Array2(i).startpoint;
endPoint=Array2(i).endpoint;
x1 = [startPoint.x;endPoint.x];
y1 = [startPoint.y;endPoint.y];
z1 = [startPoint.z;endPoint.z];
%quantity 1
figure(fig1);
hold on
plot(x1,y1);
hold off
% quantitiy 2
figure(fig2);
hold on
plot(x1,y1);
hold off
end
set(0,'DefaultFigureVisible','on')
figure(fig1)
figure(fig2)
end
My problem is that every time I call figure(*) the current figure becomes visible. each matrix can contain up to 300 line segments so this changing gets quite annoying.
I was hoping for a way to avoid making the plots in two different passes. I have attached the final results of one of two plots below. This plot is based on the full code and not the outline provided. My goal is to prevent the figures from flashing on screen

%
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!