How to stop popping up of plot figures unnecessarily in Matlab app designer?

My GUI desgned on MATLAB app designer is working perfectly. However, at one stage it is popping out a separate figure which should not appear.
How I can stop that plot figure from popping out?

 採用された回答

Amlan basu
Amlan basu 2023 年 3 月 9 日
I did it using the following command,
figure('Visible', 'off');

その他の回答 (1 件)

Kevin Holly
Kevin Holly 2023 年 3 月 9 日
If it is due to a plot function, you need to define the uiaxes for the plot. such as:
plot(app.UIAxes,x,y)

6 件のコメント

Actually when I am calling the following program to run then the attached figure (1.png) is popping out, which I want to stop.
function [array, array_C, param] = outline_BF(microwells, fudgefactor)
% Program for creating outline on 3D structrues
param = zeros(25,6); array = cell(25,1); array_C = cell(25,1);
for b = 1:25
% Outline for bright field..................................................
image = microwells{b};
[~,threshold] = edge(image,'Sobel');
BWO = imbinarize(imadjust(image), threshold*fudgefactor);
BW = imcomplement(BWO);
seD = strel('diamond',9);
BW3 = imdilate(BW,seD);
BW4 = imfill(BW3,'holes');
BWM = imerode(BW4,seD); % addition new
BW5 = imerode(BWM,ones(17));
BW6 = imdilate(BW5,ones(17));
BWoutline = bwperim(BW6, 8);
temp = imoverlay(image,BWoutline,'cyan');
bound = []; boundary = []; intensity = [];
[bound,I,~,~] = bwboundaries(BW6,'noholes');
%figure,imshow(image)
bound_S = rem_edge(I);
A = 0;
black = logical(zeros(size(BW6)));
if ~isempty(bound_S)
for k=1:length(bound_S)
boundary = bound{bound_S(k)};
Par = blob_parameters(boundary(:,2), boundary(:,1));
% labeledImage = logical(BW6);
if Par(1) > A
param(b,1:5) = Par;
plot(boundary(:,2), boundary(:,1),'r-', 'LineWidth', 1); % plot boundaries
A = Par(1);
BW7 = select_bound(black, boundary);
BW7f = imfill(BW7,'holes');
intensity = regionprops(BW7f, image, 'MeanIntensity');
param(b,6) = intensity.MeanIntensity;
end
end
else
param(b,:) = [NaN NaN NaN NaN NaN NaN];
BW7f = BW6;
end
BWoutline2 = bwperim(BW7f);
array{b} = imoverlay(temp,BWoutline2,'red');
% Canny for bright field...................................................
array_C{b} = edge(image, 'Canny');
end
change
plot(boundary(:,2), boundary(:,1),'r-', 'LineWidth', 1);
to
plot(app.UIAxes,boundary(:,2), boundary(:,1),'r-', 'LineWidth', 1);
Amlan basu
Amlan basu 2023 年 3 月 9 日
I don't want the plot to appear anywhere.
Kevin Holly
Kevin Holly 2023 年 3 月 9 日
In that case, remove the line completely.
This worked,
figure('Visible', 'off'); % I put this before and it worked
BWoutline = bwperim(BW6, 8);
Kevin Holly
Kevin Holly 2023 年 3 月 9 日
There is no need to draw the plot if you are not using it. Unless you want to save the figure without displaying it. Could speed up your program by commenting it out.

サインインしてコメントする。

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by