-1

I have a problem with Matlab. Do you know a function that plots graphs? I have a matrix that gives me information about its links and I have to draw some of them to connect the vertices. I've tried using "gplot" but it doesn't work. Thank you so much!

  • 1
    The basic function to plot graphs in Matlab is `plot(x,y)` but your question isn't precise enough to know what you want to plot exactly. If you need something more low level there's `line` as well. – meneldal Jul 08 '14 at 20:46
  • I have to draw 33 vertices and I have to link them using the information given in a matrix. Let's give an example: element in position 12 is different from zero, so I put a link between vertices 1 and 2; element in position 13 is zero, so I put no link. – user3818040 Jul 08 '14 at 21:16
  • @user3818040 what is your input? Why is gplot not working? – Daniel Jul 08 '14 at 21:35
  • My input is a matrix. Gplot doesn't give me the graph I want. – user3818040 Jul 08 '14 at 21:37
  • in this case you need to use the `line` function to draw each line separately because it doesn't seem to be something you can do with a regular plot function unless you change your data. A nice way is using NaNs to say you don't want this value to be plotted and make some "holes" in the continuous line you get from `plot` – meneldal Jul 08 '14 at 22:28

1 Answers1

1

From your comments above, it sounds as if you are looking to plot a "Graph" in the sense of connections between nodes.

This post appears to contain several answers that are likely to be helpful to you.

If not, please give a concrete example of your input and we can probably help you.

Community
  • 1
  • 1
pablo honee
  • 105
  • 1
  • 7