I only want to load some of the variables from a lot of.mat files (a1.mat, a2.mat.....) into the .m file, and use them as function. Here is my code
files=dir('a*.mat');
numfiles=length(files);
for k=1:numfiles
filename=files(k).name;
data=load(filename,'Name','Age','Country');
end
data_jan_name=[data.Name]
However, it always returns an error message:
??? Undefined variable "data" or function "data.Name".