hi,
I have a problem with the function barh when upgrading from MATLAB 2012b to MATLAB2014b.
I have the following function
function [ h ] = barh_colored(phi,cmin,cmax,loglinear)%UNTITLED Summary of this function goes here
% Detailed explanation goes here
nbars2 = 64; if cmax ~= -1 xbars=cmin:(cmax-cmin)/(nbars2-1):cmax; [counts,x] = hist(phi, xbars); else [counts,x] = hist(phi, nbars2); end if strcmp(loglinear,'log') h = barh(x,log10(counts),1); else h = barh(x,counts,1); end set(gca,'YAxisLocation','right'); ch = get(h,'Children'); fvd = get(ch,'Faces'); fvcd = get(ch,'FaceVertexCData'); cmap=get(gcf,'Colormap'); colormap(cmap); for i=1:nbars2 fvcd(fvd(i,:))=i; end set(ch,'FaceVertexCData',fvcd) if cmax ~= -1 ylim([cmin cmax]); endend
This code works fine with MATLAB 2012b. It generates plots like this:
Recently I switched to MATLAB 2014b and the code does not work anymore. Reason is that barh object does not have Children anymore so that:
ch = get(h,'Children');
returns an empty GraphicsPlaceHolder object.
How can I solve this?
Dany Benoy
Best Answer