📄 addebars.m
字号:
% ADDEBARS - Add error bars to current figure%% ADDEBARS(Yb) adds error bars in Yb to the current figure which% should be created by TSPLOT. Yb should contain error bars for% corresponding elements in Y displayed with TSPLOT.%% See also TSPLOT% This software is provided "as is", without warranty of any kind.% Alexander Ilin, Tapani Raikofunction addebars( Sbars )hax = findobj( gcf, 'type', 'axes' );for i = 1:length(hax) pos = get( hax(i), 'position'); pos2(i) = pos(2);end[tmp,I] = sort( -pos2 );hax = hax(I);for i = 1:length(hax) axes(hax(i)) Add_1_EBar( Sbars(i,:) );end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function Add_1_EBar( Sbars )h = findobj( gca, 'type', 'line' );if length(h) > 1 for i = 1:length(h) npts(i) = length( get( h(i), 'xdata' ) ); end [tmp,i] = max(npts); h = h(i);endtime = get( h, 'xdata' );S = get( h, 'ydata' );S(isnan(S)) = 0;hold onhp = fill( [ time fliplr(time) ],... [ S+Sbars fliplr(S-Sbars) ],... [ 0.6 0.6 1 ], 'edgecolor', 'none' );set( gca, 'children', flipud(get( gca, 'children' )) )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -