Effacer les filtres
Effacer les filtres

Help needed; I am missing smth obvious on private functions

1 vue (au cours des 30 derniers jours)
Maroulator
Maroulator le 12 Oct 2014
Réponse apportée : Jan le 13 Oct 2014
Below is a function (test) that I created in a directory I have named 'area1'; please note that I am using function test below to call function random0 which also resides in directory 'area1'. However, when I try to make function random0 private by creating a sub-directory named 'private' and placing the random0 function within 'private', I get an error telling me that random0 is undefined. I create the sub-directory 'private' using mkdir('area1','private') and then I drag the fx file containing random0 within 'private.' Any ideas on what it is that I am missing?
function ran1 = test(n,m,a,b) %RANDOM0 Generate uniform random numbers in [low,high) %Function test generates an array of uniform random numbers in the range %[low,high). Function random0 is private and as such resides in the private %folder.
if nargin < 2 m=n; end
ran1=(a+(b-a)*random0(n,m));

Réponse acceptée

Jan
Jan le 13 Oct 2014
Was mkdir('area1', 'private') successful, although the parent directory was not a full path? Perhaops there was a folder of this name anywhere else also?
Please check in the file browser of the operating system that you have this folder structure:
area1\test.m
area1\private\random0.m
Check if the 0 (zero) is not an O (uppercase Oh). Then try a rehash path.

Plus de réponses (0)

Catégories

En savoir plus sur File Operations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by