Help needed; I am missing smth obvious on private functions

1 回表示 (過去 30 日間)
Maroulator
Maroulator 2014 年 10 月 12 日
回答済み: Jan 2014 年 10 月 13 日
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));

採用された回答

Jan
Jan 2014 年 10 月 13 日
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.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by