MATLAB: Is it possible to display multiple edgelabels in a graph plot

digraphedgelabelgraph theory

Hi All,
I'm searching for a way to display multiple labels on an edge in a digraph plot (like is shown in the figure below). The labels should be taken from the results generated from the matlab code and are variable. At this moment I managed to only add the capacity as a label but I would also like to evaluate the flow in the plot.
I hope my question is clear to you all. Otherwise, let me know and I try to be more specific.

Best Answer

Here's an example of how to construct a custom label, using the new string class. With the older types char and cell array of char, the same can be done, but would be more cumbersome.
g = graph([1 2 3], [4 5 2], [1 3 5]);
g.Edges.Flow = [2 7 4]';
edgelabelstr = string(g.Edges.Weight) + " | " + string(g.Edges.Flow);
plot(g, 'EdgeLabel', cellstr(edgelabelstr))