Undefined function for input arguments of type 'char'.

조회 수: 453 (최근 30일)
Aaron Smith
Aaron Smith 2017년 5월 23일
댓글: Ismet 2022년 12월 19일
I have a GUI window with only two push buttons. Upon clicking the first, the callback will generate a uidir to select a folder from which to work. Then the file will be reformatted and saved as a collection of smaller files. This works well. The other pushbutton is simply intended to close this current window and open another. The problem is that when I open the figure and press pushbutton one i get the following error:
Undefined function 'Window_one' for input arguments of type 'char'.
Error in @(hObject,eventdata)Window_one('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
I have not used the handles structure in this window as there are no variable shared between callbacks and there is no figure to update. In my experience a shortage of or mistake in the declaration of handles is the reason for this error so I am slightly confused as to what the error might be caused by. Does anyone have any idea what may cause this error to arise? There are no cases on Mathworks answers of this having arisen in the same scenario with the error occurring with a GUI window.
I have attached the code along with this question
  댓글 수: 2
Muthukumar Gopalsamy
Muthukumar Gopalsamy 2020년 5월 30일
"Undefined function for input arguments of type 'char'"
One of the possible reason for such error is if your file name contain white spaces.
Eg: window one.m is not valid instead window_one.m is valid.
This can be found be commenting all your routine and just empty file. Still error is thrown then its sure file name or directory where it exist not correct.
If not then one of your routine maybe not having function definition
Rishav Saha
Rishav Saha 2021년 4월 10일
Thank you Muthukumar Gopalsamy. I had spaces in file name that's why it was not working.

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

답변 (6개)

Jan
Jan 2017년 5월 23일
You have posted the code of the function Window_one. The error message shows, that the file "Windows_one.m" cannot be found. Has the code been saved to this file? Is there a typo in the file name? Is the file contained in one of the folders of your Matlab path?
  댓글 수: 2
Aaron Smith
Aaron Smith 2017년 5월 23일
You were correct about the path. I had moved the figure into a folder of its own. Now there is another smattering of errors
Error using struct2handle
Error while evaluating uicontrol CreateFcn
Undefined function or variable 'myFile'.
Error in Window_one>pushbutton1_Callback (line 84)
if ~isdir(myFile) % if the directory is not a valid path
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in Window_one (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)Window_one('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Undefined function or variable 'myFile'.
Error in Window_one>pushbutton1_Callback (line 84)
if ~isdir(myFile) % if the directory is not a valid path
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in Window_one (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)Window_one('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Is this likely due to issues with save paths and directories as well_ If so this is going to be a major problem as I have files that need to be taken from several folders
Jan
Jan 2017년 5월 26일
@Aaron: The error message is clear: The variable "myFile" has not been created before.

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


Guillaume
Guillaume 2017년 5월 23일
I assume the callback itself is defined in the associated GUI figure.
One possibility is that by the time the callback is called, the current directory has been changed (with cd or through matlab gui) so your Window_one gui function is no longer on the path.
  댓글 수: 2
Muhammad Qasim Khan
Muhammad Qasim Khan 2018년 4월 23일
"!! Submission failed: Undefined function 'makeValidFieldName' for input arguments of type 'char'." please help me
Walter Roberson
Walter Roberson 2018년 4월 23일
Please show the complete error message, everything in red.

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


HABTE TADESSE LIKASSA
HABTE TADESSE LIKASSA 2018년 10월 20일
Undefined function 'norm' for input arguments of type 'char'.
Error in DRMF (line 31) Y1 = X/norm(X,'fro');
Please how can I tackle this problem, can u help me ?

shazil shoukat
shazil shoukat 2019년 9월 20일
Undefined function 'Program' for input arguments of type 'char'.
this error occur when i run the code . what can i do
  댓글 수: 3
Preetam
Preetam 2022년 12월 8일
I'm also facing the same issue. If not by full path, how are we supposed to do the same?
Rik
Rik 2022년 12월 8일
You can either cd to that folder, or use the run function.

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


aanshika singh
aanshika singh 2021년 5월 26일
Undefined function 'xlable' for input arguments of type 'char'.
Error in basic_signal (line 26)
xlable('\bfn')
  댓글 수: 1
Rik
Rik 2021년 5월 26일
You forgot to ask a question and you posted this as an answer. Anyway, you probably mean xlabel instead of xlable.

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


Ismet
Ismet 2022년 12월 17일
>> parrotMinidroneCompetitionStart
Warning: Undefined function 'designfilt' for input arguments of type 'char'.
HOW CAN I FIX THAT ??*
  댓글 수: 2
Walter Roberson
Walter Roberson 2022년 12월 17일
You need the Signal Processing Toolbox, R2014a or later.
Ismet
Ismet 2022년 12월 19일
thanksss

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

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by