MATLAB: Load—-problem in using this commad

load

i have wriiten a code to load 100 txt files of a data and the line of code marked bold is not working ….plz help me..
for i=1:1:100
tmp=num2str(i);
f={'F'};
ze={00};
tx ={'.txt'};
if(i<10)
ze={'00'};
fnam=strcat(f, ze, tmp, tx);
else
if(i==100)
fnam=strcat(f, tmp, tx);
else
ze={'0'};
fnam=strcat(f, ze, tmp, tx);
end
end
* X = load(fnam)**BOLD TEXT*
end

Best Answer

I have 100 text file with filenames F001.txt, F002.txt, F003.txt, ... , F010.txt, F011.txt, ... F100.txt.
Use this code below to import your text files
for i = 1 : 100
if (i < 10), ze = '00';
elseif (i == 100), ze = '';
else, ze = '0';
end
filename = strcat('F',ze,num2str(i),'.txt');
fid = fopen(filename);
C(i) = textscan(fid,'%s');
end