private folder does not work with live scripts

6 vues (au cours des 30 derniers jours)
Brian
Brian le 20 Juin 2025
Commenté : Stephen23 le 23 Juin 2025
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 commentaires
Matt J
Matt J le 20 Juin 2025
Modifié(e) : Matt J le 20 Juin 2025
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,

Connectez-vous pour commenter.

Réponses (1)

Meet
Meet le 23 Juin 2025
Modifié(e) : Meet le 23 Juin 2025
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:

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by