barweb error message in negative value

ampl = squeeze(dtopstore(:,:,3,chan));
order = [1:6]
ampl = ampl(order,:);
figure;
barweb([nanmean(ampl(1:2,:)') NaN nanmean(ampl(3:4,:)') NaN nanmean(ampl(5:6,:)')],[nanstd(ampl(1:2,:)')/sqrt(10) NaN nanstd(ampl(3:4,:)')/sqrt(10) NaN nanstd(ampl(5:6,:)')/sqrt(10)]);
The error message is
Bad property value found. Object Name : axes Property Name : 'YLim' Values must be increasing and non-NaN.
Error in ylim (line 44) set(ax,'ylim',val);
Error in barweb (line 161) ylim([ymax*1.1 0 ]);
Error in script (line 116) barweb([nanmean(ampl(1:2,:)') NaN nanmean(ampl(3:4,:)') NaN nanmean(ampl(5:6,:)')],[nanstd(ampl(1:2,:)')/sqrt(10) NaN nanstd(ampl(3:4,:)')/sqrt(10) NaN nanstd(ampl(5:6,:)')/sqrt(10)]);
not sure how to deal with it
Andrew

Réponses (1)

Andrew
Andrew le 3 Fév 2014
Modifié(e) : Andrew le 3 Fév 2014
Sorry for the late reply, but I just ran into this problem myself. When you input negative values for your bars, the value ymax is 0, so setting ylim([0 0]) results in your error.
I added two lines
line#115
ymin = 0
line#158, inside the %Plot errors loop
ymin = min([ymin; barvalues(:,i)-errors(:,i)]);
and replaced ylim, line#165
ylim([ymin*1.1 ymax*1.1]);

Tags

Question posée :

le 6 Mai 2013

Modifié(e) :

le 3 Fév 2014

Community Treasure Hunt

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

Start Hunting!

Translated by