Jump to content

How to draw a polyline?

Recommended Posts


I would like to draw a polyline into a figure.


I tried to use the function "polyline" but unfortunately there is no help availabe to this function.


I tried this:

polyline('position',[5 5;4 6;4 7;5 8;6 8;7 7; 7 6]);


But its not working. A figure is created without axes and polyline. No error messages occours.





Share this post

Link to post
Share on other sites



You are right, the Help is missing for this function and it will come in the next release (v2019.3).


The syntax for it would be:

     data = [5 5;4 6;4 7;5 8;6 8;7 7; 7 6]';
     h = polyline(1, 'polydata', data);

Where the first argument is figure handle and the third one is the data set. In your case, the figure will be very small using these inputs:



But if you slightly change your data set to data = [5 5;104 106;104 7;5 8;106 8;7 7; 7 106]', for instance, we'd get:






NilsWaap likes this

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...