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));
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!