MATLAB: Using linkdata works while deugging step by step but fails to update graph when run normally

histlinkdataMATLABreal time

hello,My code should run in real time and update 4 histograms in the same figure responding to changes in there linked data. while it successfully updates the histograms when debugged step by step, it fails to do so when I run it normally or when using continue. Any ideas how to make the histogram update?
**Notice this is an app for real time and should perform fast.
**if(fastUpdateFlag) is performed the first time the function is called. Followed calls while always be with fastUpdateFlag == false.
if(fastUpdateFlag)
[n,xout] = hist(data,nBins);
set(0,'CurrentFigure',fast_fig)
for jj=1:nGraphs
fast_fig = subplot(nGraphs,1,jj);
format = 'n(:,%d)';
barParam = sprintf(format, jj);
bar(xout,n(:,jj),'YDataSource',barParam);
ttle = sprintf('Fast update electrode number: %d', numOfElecToPresent(jj));
title(ttle);
xlabel('time bins (sec) ');
ylabel('count ');
end
fastUpdateFlag = 0;
return;
end
linkdata on
set(0,'CurrentFigure',fast_fig);
[n,xout] = hist(data,nBins);
Thanks!

Best Answer

problem solved using:
refreshdata(slow_fig,'caller');