Why do I get the error "Undefined 'matlab.gr​aphics.ill​ustration.​internal.g​etLegendab​leChildren​'" when using the function 'legend'?

4 ビュー (過去 30 日間)
I recently updated my MATLAB release to R2018b. I obtain an error when using the "legend" command, as it happens in the example below:
>> clear
>> close all
>> figure,plot(0,1)
>> legend('Test')
Undefined function or variable 'matlab.graphics.illustration.internal.getLegendableChildren'.
Error in legend (line 261)
make_legend(ha,args(arg:end),version);

採用された回答

MathWorks Support Team
MathWorks Support Team 2019 年 11 月 15 日
編集済み: MathWorks Support Team 2019 年 11 月 15 日
This error may be due to the file containing the legend functions not being correctly located. Please check that it can actually be found in the MATLAB path by executing:
>> which -all matlab.graphics.illustration.internal.getLegendableChildren
The output of this command should be something like:
<matlabroot>\toolbox\matlab\graphics\illustration\+matlab\+graphics\+illustration\+internal\getLegendableChildren.m
where 'matlabroot' is the output of the homonymous command.
In case it cannot be found from within MATLAB, please navigate to the respective "+internal" folder (as in the example path above), and check that the file "getLegendableChildren.m" is actually there.
If the file is not present in this folder, it may be that your MATLAB installation is incomplete. You would then need to re-install it.
If the file is present inside the "+internal" folder, please restore the default path in order to fix your issue. You can do this by executing the following in MATLAB Command Window:
>> restoredefaultpath
>> rehash toolboxcache
After doing so, you should be able to use MATLAB normally. Please check that the issue is fixed, and if that is the case, please save the new MATLAB search path by executing the following command in MATLAB Command Window:
>> savepath

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by