MATLAB: Why polybuffer example doesn’t work

doublelinematrixmatrix arraymatrix manipulationpolybuffer

I'm trying to use the function polybuffer for 2-D points or lines as in example:
P = [0 0; 1 1; 2 1];
polyout = polybuffer(P,'points',0.25)
plot(P(:,1),P(:,2),'r.','MarkerSize',10)
hold on
plot(polyout)
axis equal
or
P = [0 0; 1 1; 2 1];
polyout1 = polybuffer(P,'lines',0.25);
plot(P(:,1),P(:,2),'r.','MarkerSize',10)
hold on
plot(polyout1)
axis equal
hold off
but keep getting the following error:
Undefined function 'polybuffer' for input arguments of type 'double'.
Though the function works fine when using the following example:
polyin = polyshape({[0 0 1 3],[0.5 1.5 1.5 0.5]},{[0 3 3 0],[0.5 0.5 1.5 1.5]});
plot(polyin)
polyout1 = polybuffer(polyin,0.1);
hold on
plot(polyout1)
hold off
does anyone have an idea what did i do wrong ?
Thank you so much

Best Answer

does anyone have an idea what did i do wrong

Yes, most likely you're not using R2018a, which, for now, is the only version where polybuffer is implemented.