MATLAB: How to read a .txt file

fileMATLABreadtext;

Is it possible to read this file line by line and create two matrices with two columns and a different number of lines?
The file looks like this and it's created with a function for storing some fingerprint data and associating it with a name and birth date:
And I want to create a matrix with the values of X and Y on two columns for both types.
Let me translate those lines:
Nume - Name;
Data - Birth Date;
Numar de sfarsituri de crestatura - Number of ridge endings;
Numar de bifurcatii - Number of bifurcations;
Sfarsituri de crestatura - Ridge Endings;
Bifurcatii - Bifurcations;
As I said, every ridge ending or bifurcation has two coordinates (they're in a matrix, of course). For example, lets say I want the ridge endings thingy. I need to read those lines and print a matrix like this: SFC = [84 32;78 60;131 105; … ]
Is that possible?

Best Answer

fid=fopen('fic.txt')
l=fgetl(fid)
k=1
while ischar(l)
r{k}=l
l=fgetl(fid)
k=k+1;
end
fclose(fid);
ii=find(~cellfun(@isempty,regexpi(r,'x\sy')));
idx=ii+1;
idy=[ii(2:end)-1 numel(r)];
M=regexpi(r(idx(1):idy(1)),'\d+','match');
jj=~cellfun(@isempty,M);
M=M(jj);
M=reshape(str2double([M{:}]),2,[])'
N=regexpi(r(idx(2):idy(2)),'\d+','match');
jj=~cellfun(@isempty,N);
N=N(jj);
N=reshape(str2double([N{:}]),2,[])'