findobj not working with Matlab 2014b

4 views (last 30 days)
Ksawery
Ksawery on 13 Nov 2014
Commented: Geoff Hayes on 14 Mar 2016
Hello,
I have a GUI that I developed using Matlab 2014a using the interactive Matlab tool. The GUI consists of multiple windows, which communicate and pass data to each other using getappdata and setappdata. I use findobj(...,'Tag',handle) to find the handles of different axes, sliders, text boxes, and edit boxes within the different windows. This worked perfectly fine before upgrading to Matlab 2014b. Now my tool has stopped working due to object handle errors. In debug, I found that whenever I attempt to retrieve an object handle using findobj , I get something with the following value:
0x0 GraphicsPlaceholder
What does this mean and how can I overcome this problem? Any help would be greatly appreciated.
Many thanks, Ksawery
  6 Comments
abc
abc on 2 Apr 2015
I am facing a similar issue. Following is my code for progressbar on one of my GUI interfaces. How do I make it work in MATLAB 2014b.
function h=mywaitbar(x,whichbar,varargin)
% Funciton: create and display a wait bar
if ischar(whichbar) || iscellstr(whichbar)
if nargin==4
h_figure=varargin{1};
pos=varargin{2};
hbar=waitbar(x,whichbar,'visible','off');
h1=get(hbar,'children');
h1_patch=findall(h1,'type','patch');
h1_line=findall(h1,'type','line');
set(h1,'color',[0.91 0.91 0.91]);
set(h1_patch,'facecolor',[0.04 0.52 0.78],'edgecolor',[0.04 0.52 0.78]);
set(h1_line,'color',[0.94 0.94 0.94]);
h_axs=copyobj(h1,h_figure);
set(h_axs,'position',pos)
delete(hbar);
end
elseif isnumeric(whichbar)
h_axs=whichbar;
p=findall(h_axs,'Type','patch');
set(p,'XData',[0 100*x 100*x 0])
if nargin==3
hTitle=get(h_axs,'title');
set(hTitle,'string',varargin{1});
end
end
h=h_axs;
Geoff Hayes
Geoff Hayes on 14 Mar 2016
Sebastian Bahamonde's answer moved here
I am facing the same problem. Cannot find an answer :(.
Long story short, I use a third party function to change the area pattern (hatchfill):
Very easy to use, I do this:
%%%%%
h = area(X , Y');
[row col] = size(Y);
for i = 1 : row
hPatch(i).h = findobj(h(i), 'Type', 'patch');
hh1 = hatchfill(hPatch(i).h, Plot_op.patt{i}, Plot_op.angle(i), Plot_op.space(i));
end
%%%%
As you may imagine, X and Y contain various areas identifiers, and Plot_op contains the info required by hPatch to customize the areas.
I'd appreciate any idea.
Thanks for your time.
Sebastian

Sign in to comment.

Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!