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

回答 (1 件)

Andrew
Andrew 2014 年 2 月 3 日
編集済み: Andrew 2014 年 2 月 3 日

0 投票

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]);

タグ

質問済み:

2013 年 5 月 6 日

編集済み:

2014 年 2 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by