if ~isempty(get(groot,'CurrentFigure')) %若是現有的窗口沒有圖
disp('There are existing figures.') %顯示There are existing figures
else
disp('There are no existing figures.') %顯示There are no existing figures
end
if ~isempty(findobj('Tag','myFigures'))
disp('There are objects with this tag.')
%顯示There are objects with this tag
else
disp('There are no objects with this tag.')
%顯示There are no objects with this tag
end
if isgraphics(h,'figure')
disp('h is a valid figure handle.')
else
disp('h is not a valid figure handle.')
end
if isequal(h,groot)
disp('h is the root handle')
else
disp('h is not the root handle')
end
p = plot(magic(3));
par = get(p,'Parent');
objarray = [par{:}]';
whos objarray
p1 = plot(1:10);
p2 = p1;
p2 == p1
l1 = line;
l2 = line;
isequal(l1,l2)
t = num2str(rand);
fh = @(t) text(1,1,t);
th = cellfun(fh,{t},'UniformOutput',false);
END0 篇文章
如果覺得我的文章對您有用,請隨意打賞。你的支持將鼓勵我繼續創作!