[Help] Undefined function or variable 'Reference'. On Running a .m script file.

Hello Everyone,
While running a .mat file I am incurring the following error:
Undefined function or variable 'Reference'.
But when i select all the code and press evaluate section, it executes the code.
Can any one guide me, how to overcome this? and why this happens?
This is how my .mat file starts:
%% Reference_Project: Excel List
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% Function: Getting a Unique list.
% Filename: List.m
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%
clear;
clc;
disp('Starting the Program, Please click on Next and Finish (if it appears).');
warning off;
%% Selects the Current Directory and Imports all the files with .xls extension.
% % Note: .xls files and this code should be in same folder.
myDir = uigetdir; %Gets the current directory
myFiles = dir(fullfile(myDir,'*.xls')); %Gets all .xls files in structure
fileNames = {myFiles.name}; % to convert the name of files in string format
for k = 1:numel(fileNames) % running a loop from 1 till number of files
data{k} = uiimport(fileNames{k}); % importing k number of files
%%do whatever you want
end
Any help would be appreciated :-).
Regard,s
Waqar Ali

댓글 수: 7

Just a note: A '.mat' file can't be executed (it only contains data). You mean '.m' file.
Please, upload the code, at least the part which is causing the error.
Yes, that is .m file. I have added a complete code.
Thank you for your time :-)
There is no call to 'Reference' in yor code. Can you show the full error text (all red text)?
True. This is also my question that there is no any call to "Reference" but I am getting this error. This is the only error that I am getting. I have attached an image below.
error.png
Thank you :-)
I renamed the .m file to EPD-Projecz-v2 and now the error comes for EPD.
error2.png
Don't use minus (-) in the M-file name. Instead, use underscore (_).

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

 채택된 답변

Alex Mcaulley
Alex Mcaulley 2019년 7월 31일
The name of your script "Reference-EPD-Project-v4" is not a valid name for a function/script. Are you sure that this is the name? If it is the case, change the name of the file to a valid name (i.e. "Reference_EPD_Project_v4").

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2017b

질문:

2019년 7월 31일

댓글:

2019년 7월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by