I have a vector of filenames as strings and am trying to feed them in to xlsread
one by one in a loop. Here's my code (sorry for the long list of fnames):
all_u_fnames={'u_results_901.xls','u_results_902.xls','u_results_903.xls','u_results_904.xls','u_results_905.xls'...
'u_results_906.xls','u_results_907.xls','u_results_908.xls','u_results_909.xls','u_results_910.xls'...
'u_results_911.xls','u_results_912.xls','u_results_913.xls','u_results_914.xls','u_results_915.xls'...
'u_results_916.xls','u_results_917.xls','u_results_918.xls','u_results_919.xls','u_results_920.xls'...
'u_results_921.xls','u_results_922.xls','u_results_923.xls','u_results_924.xls','u_results_925.xls'...
'u_results_926.xls','u_results_927.xls','u_results_928.xls','u_results_929.xls','u_results_930.xls'};
for i = 1:length(all_u_fnames)
fnameU=all_u_fnames(i);
u1=xlsread(fnameU,'Point_5','A:U');
u2=xlsread(fnameU,'Point_6','A:U');
u3=xlsread(fnameU,'Point_7','A:U');
u4=xlsread(fnameU,'Point_8','A:U');
I keep getting the error Filename must be a string.
How is the fnameU
that I'm inputting into xlsread not a string here?
Thanks, Alex
Try:
for i = 1:length(all_u_fnames)
fnameU=all_u_fnames{i};
You are passing a cell element.