lag with "figure" function
이전 댓글 표시
I have devised this function in order to make new figures appear where I want them to.
function figuree(varargin)
tic
if ~isempty(varargin)
if varargin{:}>0 && length(varargin{:})<2
figure(varargin{1})
else
error('illegal figuree arguments \n Arguments must be the same as figure')
end
else
toc
figure()
toc
end
set(gcf,'OuterPosition',[1,470,500,558])
This goes perfectly well.
But when I make for example this call:
close all
clear all
figure
figure
figure
figuree(2)
figuree
figuree(2)
figuree
this is my output:
Elapsed time is 0.000186 seconds.
Elapsed time is 0.260609 seconds.
Elapsed time is 0.000017 seconds.
Elapsed time is 3.168427 seconds.
My question is why do I have a sudden 3 second delay ??! (I will also accept advice about how to make new figure appear where I want them to)
채택된 답변
추가 답변 (1개)
Walter Roberson
2011년 4월 6일
Have you considered
set(0,'DefaultFigureOuterPosition', [1,470,500,558])
figure() can take a variable length of time because MATLAB processes the event queue each time figure() is called.
댓글 수: 3
j dr
2011년 4월 11일
Walter Roberson
2011년 4월 11일
Your apparent 3 second delay might be because you have no toc() for the case where you pass arguments.
By the way, your code for working with varargin is not correct. Test it out by passing multiple arguments...
j dr
2011년 4월 19일
카테고리
도움말 센터 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!