violinplot (R2024b): SceneNode error?

17 ビュー (過去 30 日間)
Jyot Antani
Jyot Antani 2025 年 4 月 11 日
コメント済み: Richard DeFazio 2025 年 9 月 19 日 18:00
I am trying to use the violinplot function, tried the following official example
ydata = randn(100,1);
xgroupdata = categorical(repelem(["group1";"group2";"group3"],[20,50,30]));
violinplot(xgroupdata,ydata)
I get the following warning in client area:
Warning: Error in state of SceneNode.
Undefined function 'log2' for input arguments of type 'string'.
and NOTHING gets plotted in the figure!
Please help.

採用された回答

Walter Roberson
Walter Roberson 2025 年 4 月 11 日
The typical cause of this sort of problem, is if you have a third-party .m file with the same name as a Mathworks function.
To debug the problem, experiment with
restoredefaultpath; rehash toolboxcache
if this solves the problem then you know that something that had been added to the path was the cause. (If it does not solve the problem, try creating an empty directory and cd'ing to it and running the code again, to test out the hypothesis that something in your current directory was the problem.)
  6 件のコメント
Jyot Antani
Jyot Antani 2025 年 4 月 14 日
Intriguing. I have a decent sized GitHub library added to genpath in startup so it's not practical to show all functions here.
Another interesting observation which solved my problem: If I add a pause before startup, the plot remains (doesn't get blanked out). I don't think the pause time matters because even pause(0.001) worked.
Richard DeFazio
Richard DeFazio 2025 年 9 月 19 日 18:00
Just in case anyone else wanders here wondering why their violinplots don't work: If you use the calcium imaging analysis code CaImAn (MATLAB version) or any analysis package that includes CaImAn, this code includes a function called kde() that appears to "shadow" an identically named MATLAB function as described above. Renaming the CaImAn kde function, the file name to match it, and the calling code in other CaImAn functions, allows violinplot to work again.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by