Hi there,
I tried to run a self-written code which called another self-written sub-function. The code message is attached below:
Undefined function 'name of the function' for input arguments of type 'char'.
But both codes are located in the same folder.
I am running matlab R2001b under a linux system. Matlab was started on a local machine and ran codes sitting on a remote server.
Any suggestions?
Thanks in advance.
Jun

답변 (1개)

John D'Errico
John D'Errico 2016년 8월 28일
편집: John D'Errico 2016년 8월 28일

0 개 추천

First of all, that is not a sub-function. If it is saved in a separate file, it is just an m-file, that anything can call.
A sub-function is a function inside another function, callable only by the main function or other subs within the main function in general. (With one exception.)
1. Is this directory on your search path? If not, then you need to learn to use addpath, savepath, pathtool. Of course, you can also CD to the directory in question, because the current directory is always on your search path. But better to use the path tools.
2. Is the directory one of the main MATLAB directories? If so, DON'T DO THAT! Move your functions to another directory that is NOT one provided by TMW. Those directories are cached at startup, but not then checked again to see if you have added new files.
My guess is the latter is the case.
If one of the above answers does not apply, then you need to tell us more specifics about your problem. Showing us the code might help.

댓글 수: 1

Jun Zhao
Jun Zhao 2016년 8월 28일
편집: Jun Zhao 2016년 8월 28일
John, thanks for your reply. Sorry for the misleading.
To answer your questions, please my answers below:
1. No. the directory is not on my search path.
2. No. The directory is not one of main MATLAB directories and is self-defined.
I ran my codes operationally. The codes started working since June 6 2016 and everything was fine. The issue mentioned above just happened twice since two weeks ago. When I encountered the error, I restarted the code again and everything worked. So, I think the issue is not directory related.
For your convenience, the main code is attached. It calls another function called simulate_maps_read_time_v12.m. The error message was
Undefined function 'simulate_maps_real_time_v12' for input arguments of type 'char'.
Thanks.
Jun

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

질문:

2016년 8월 28일

편집:

2016년 8월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by