Jump to content
NilsWaap

How to draw a polyline?

Recommended Posts

Hello,

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.

 

Regards

 

Nils

Share this post


Link to post
Share on other sites

Nils,

 

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]';
     figure(1);
     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:

image.png.c51fc7b256d9f316994a9e3de1474e85.png

 

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:

image.png.38aa90e4802e8d7f8e84a75d30731acf.png

Regards,

 

Roberta

 

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.

Guest
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...