Matlab 2017b library functions don't match online documentation.

Hi,
I am using academic version of Matlab 2017b and was developing plots for network graphs. I was following documentation given on this web page: https://in.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.graphplot.layout.html
However, when I tried to plot graph using force layout with influence of weights as mentioned in the documentation it threw me an error.
I dig deeper into the issue and realized that:
Although for the function layout: Keyword 'Force' is supposed to have name value pair "WeightEffect", when I run help layout in my matlab console I find that "WeightEffect" is not a valid name value pair. This is despite the fact that online documentation says it has been released in 2015b.
layout(H,METHOD,NAME,VALUE) uses additional options specified by one or
more Name-Value pair arguments. The optional argument names can be:
'force' Supports 'Iterations', 'XStart', 'YStart'.
'force3' Supports 'Iterations', 'XStart', 'YStart', 'ZStart'.
'layered' Supports 'AssignLayers', 'Direction', 'Sinks', 'Sources'.
'subspace' Supports 'Dimension'.
'subspace3' Supports 'Dimension'.
See the reference page for a description of each Name-Value pair.
Warm regards,
Varshit Dusad

2 Comments

kindly specify how you are calling layout?
Hi Madhan,
I am using the following two commands to call the layout function to plot my directed graphs.
p = plot(H,'Layout','force','NodeColor','r');
layout(p,'force','WeightEffect','direct')
H in the above command is my digraph object.
Warm regards,
Varshit Dusad

Sign in to comment.

 Accepted Answer

I's no surprise that the documentation you're looking at doesn't match what happens in your version of matlab. The documentation you're looking at is for the latest version (R2018b at the moment). You should look at the documentation pertaining to the version you're using, not the latest one. The easiest is to use the documentation installed on your computer since it always match your version.
If you're looking at the online documentation, you need to use the versioned URL which has a releases/R2017b/ after the help/ part of the URL. So for the function you were looking at: https://in.mathworks.com/help/releases/R2017b/matlab/ref/matlab.graphics.chart.primitive.graphplot.layout.html. You need to be logged in and have a valid license associated with your account to be able to see the versioned documentation online.

2 Comments

Thanks Guillaume,
Thank you for your answer. It makes sense and I had similar thoughts. However, I was confounded by the description introduced in 2015b. But, I suppose even though the function was introduced it has been modified since then. I will take extra precautions in the future.
Warm regards,
Varshit Dusad
The note "Introduced in R20xxy" at the bottom of the documentation page indicates when the function was introduced, not when the documentation and/or the function was last modified.
For this specific option, searching the Release Notes indicate that the WeightEffect name-value pair was introduced in release R2018a.
As two alternatives to Guillaume's URL manipulation, if you navigate to the documentation via the Support website's Documentation link you'll start at this page. There's an "Other Releases" link immediately above the blue box labeled MATLAB. Alternately, your local installation should have the documentation for that installation's release installed that you can access using the doc function assuming the Help Preferences are set to show the locally-installed documentation.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!