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

댓글 수: 3

John D'Errico
John D'Errico 2018년 4월 17일
편집: John D'Errico 2018년 4월 17일
When something does not work because it is not found, the very first question you should ask of yourself is what version of MATLAB you have. polyshape is fairly new as I recall.
If you are using an old release of MATLAb, you could/should look to see if that function was not created until after your release was issued. If not, then what can you expect?
If you have a current release, you might look to see if that code is in a specific toolbox you don't have. But polyshape is in MATLAB proper, at least if you have a current release.
So show the results from the ver command.
Guillaume
Guillaume 2018년 4월 17일
polyshape requires R2017b or later, but polybuffer is even newer and requires the latest version: R2018a.
Faez Alkadi
Faez Alkadi 2018년 4월 17일
편집: Faez Alkadi 2018년 4월 17일
Hi John,
My matlab is R2017b. And as i said in the question polyshape is working fine with the last example.
i run ver and got the following :
MATLAB Version 9.3 (R2017b)
Simulink Version 9.0 (R2017b)
Control System Toolbox Version 10.3 (R2017b)
DSP System Toolbox Version 9.5 (R2017b)
Data Acquisition Toolbox Version 3.12 (R2017b)
Image Processing Toolbox Version 10.1 (R2017b)
Instrument Control Toolbox Version 3.12 (R2017b)
Mapping Toolbox Version 4.5.1 (R2017b)
Optimization Toolbox Version 8.0 (R2017b)
POLYGONS Manipulation of planar polygons and po... Version 1.6 21-Mar-2011
Signal Processing Toolbox Version 7.5 (R2017b)
Simulink Control Design Version 5.0 (R2017b)
Statistics and Machine Learning Toolbox Version 11.2 (R2017b)
Symbolic Math Toolbox Version 8.0 (R2017b)
>>

댓글을 달려면 로그인하십시오.

 채택된 답변

Guillaume
Guillaume 2018년 4월 17일
편집: Guillaume 2018년 4월 17일

0 개 추천

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.

댓글 수: 1

Faez Alkadi
Faez Alkadi 2018년 4월 17일
Thank you Guillaume, i just updated my matlab to R2018a And it is working now.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Sparse Matrices에 대해 자세히 알아보기

질문:

2018년 4월 17일

댓글:

2018년 4월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by