Why am I unable to set the properties of the line objects of the ERRORBAR function in MATLAB 6.5 (R13)?

1 view (last 30 days)
I am using the ERRORBAR function in MATLAB 6.5 (R13):
X = 0:pi/10:pi;
Y = sin(X);
E = std(Y)*ones(size(X));
errorbar(X,Y,E,'LineWidth',3);
On executing this code I receive the following error:
??? Error using ==> errorbar
The sizes of X, Y, L and U must be the same.
I do not receive this error while using the PLOT or the PLOT3 functions in MATLAB 6.5 (R13).

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This enhancement has been added in MATLAB 7.0 (R14) and later versions. For previous releases, read below for any possible workarounds.
This is the expected behavior of the ERRORBAR function in MATLAB 6.5 (R13). It is a limitation with the ERRORBAR function that you cannot set the "LineWidth", "MarkerEdgeColor", "MarkerFaceColor" and the "MarkerSize" or any other properties by specifying the property name and its value. All the properties can be set by using PLOT or the PLOT3 functions in MATLAB 6.5 (R13). You can however set the "LineStyle", "MarkerSymbol" and the "Color" properties by giving all these 3 properties in a single argument as shown in the code below:
errorbar(X,Y,E,'-.r*');
To workaround this issue, you can get a handle to the errorbar's line graphic objects and then set the properties of these line objects as shown below:
H = errorbar(X,Y,E);
set(H(1),'LineWidth',3);
set(H(2),'MarkerSize',12);

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!