private folder does not work with live scripts

6 ビュー (過去 30 日間)
Brian
Brian 2025 年 6 月 20 日
コメント済み: Stephen23 2025 年 6 月 23 日
Live scripts don't seem to support running functions inside a private folder as of R2024B, whereas normal scripts and functions do. An easy workaround is to rename the folder to something else and add it to path. I'm not sure if this is the right place for feedback, but would it be possible to fix this in future releases?
See attached for a minimal reproducible example.
  2 件のコメント
Matt J
Matt J 2025 年 6 月 20 日
編集済み: Matt J 2025 年 6 月 20 日
You can't be certain of an audience of MathWorks employees seeing anything here, though sometimes they do visit. You should submit a bug report,

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

回答 (1 件)

Meet
Meet 2025 年 6 月 23 日
編集済み: Meet 2025 年 6 月 23 日
Hi Brian,
I was able to reproduce the issue on my end using the example you provided. Since both the "mre.mlx" and "mre2.m" scripts are at the same level in the private folder, I could access the "foo" function within the folder.
Private functions are useful when you want to limit a function's scope. You mark a function as private by placing it in a subfolder named "private." This makes the function accessible only to scripts and functions in the folder directly above the private subfolder.
For more information on "private" functions, you could refer to this MathWorks documentation:

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by