How to draw a polyline?
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
Answers
-
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:
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:
Regards,
Roberta
0