[Help] Undefined function or variable 'Reference'. On Running a .m script file.
Show older comments
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 Comments
Alex Mcaulley
on 31 Jul 2019
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.
Waqar Ali Memon
on 31 Jul 2019
Alex Mcaulley
on 31 Jul 2019
There is no call to 'Reference' in yor code. Can you show the full error text (all red text)?
Waqar Ali Memon
on 31 Jul 2019
Waqar Ali Memon
on 31 Jul 2019
Fangjun Jiang
on 31 Jul 2019
Don't use minus (-) in the M-file name. Instead, use underscore (_).
Waqar Ali Memon
on 31 Jul 2019
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
