for k = 1:10 FileName1 = ['EqvStr_',num2str(k),'.csv']; filename1 =fullfile('E:\ANSYS_FILES\BigKB', FileName1); A = xlsread(filename1,'A2:E1000'); vectorname = ['a',num2str(k)]; vectorname = A(:,1); end disp(a1) disp(a2) disp(a3) disp(a4) disp(a5) disp(a6) disp(a7) disp(a8) disp(a9) disp(a10)
So I am running the above code and MATLAB gives me an error message saying "Undefined function or variable 'a8'". It is weird because it IS showing me the results if I comment out the a8, a9, and a10 lines from the code but gives me the error message if not. There are a 1090 files in the folder in that name format and I am just testing the code with the first 10 but it is showing me this error. Can anyone please help me understand what the problem here is?
Best Answer