Help needed; I am missing smth obvious on private functions

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by