MATLAB: Importing txt files and using loops

txt

I have three txt files and I want to use their nummerical data in Matlab
How can I ignore and neglect non-numeric texts? I want Matlab to import just numbers, there two columns of numbers in each file and I want just those numbers
I have more than one file. Here I have three files. Is it possible to use for loop to import these files and buy time?

Best Answer

%% Reading the file
FID_F_1 = fopen(filename , 'r');
i = 1;
tline = fgetl(FID_F_1);
A{i} = tline;
while ischar(tline)
i = i+1;
tline = fgetl(FID_F_1);
A{i} = tline;
end
fclose(FID_F_1);
Now all text is saved in variable A.
for ii = line where data starts : line where data ends
X_Temp = str2num(A{ii}); %converts the string line into array
X = X_Temp(1,1); %
Y = X_Temp(1,2); % Getting the values
end