I am trying to pull data from multiple files in a directory. I have written a for loop to get to the specified file, but when I search for the file using an * is cannot be found. For example, the file name 072814_Nominal.xls and another file in the same directory might be called 081213_Nominal.xls. I want to pull date from only files with "Nominal" in the name. I have tried using the below loop
D=dir(pathname);for i=1:length(D) if D(i).name=='*Nominal.xls' %this line is trouble - says matrix dimensions must agree
filename=fullfile(pathname,D(i).name); temp(i)=xlsread(filename,'Sheet1','R4'); else endend
but I am getting the "Error using ==", "matrix dimensions must agree" error and I cannot find a way to make Matlab find the file that looks like 'Nominal' or 'Nominal.xls' (I have tried both). Please help!
Best Answer