Unrecognized function or variable
이전 댓글 표시
Hello,
I'm trying to run the beginning of a script that was sent to me:
function [ FList ] = ReadFileNames(DataFolder)
DirContents=dir(DataFolder);
FList=[];
DataFolder is the name of the folder in which all my data is held. When I click the Run button I receive:
ReadFileNames(DataFolder)
Unrecognized function or variable 'DataFolder'.
And I'm not sure why?
Any help is much appreciated. Thank you.
댓글 수: 2
DGM
2021년 12월 28일
Where is DataFolder defined? If you haven't defined it, you will need to do so.
Kiran Yendamuri
2021년 12월 28일
답변 (1개)
Tell the program what your data folder is
DataFolder = 'C:\';
ReadFileNames(DataFolder)
function [ FList ] = ReadFileNames(DataFolder)
DirContents=dir(DataFolder);
FList=[];
end
댓글 수: 4
Kiran Yendamuri
2021년 12월 28일
John D'Errico
2021년 12월 28일
You are still trying to run your function, as if it was a script. You even called it a script, and said you are clicking the run button. This is a function.
Kiran Yendamuri
2021년 12월 28일
카테고리
도움말 센터 및 File Exchange에서 MATLAB Coder에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!