Thanks for reading and any support in advance. I am trying to read multiple text files in a folder for which I have the following code. The source of the data is this kaggle dataset - https://www.kaggle.com/kmader/pulmonary-chest-xray-abnormalities
files = dir(fullfile('archive.1/ChinaSet_AllFiles/','ChinaSet_AllFiles','ClinicalReadings','*.txt'));
N = length(files)
data = 
for i = 1:N
t = files(i).name;
formatspec = '%s %s%*[^\r\n]%*[\r\n]+%s';
file = fopen(fullfile(files(i).folder,t),'r');
A = textscan(file , formatspec, 'delimiter','\n');
data = [data; A];
It loops through the files fine but the files themselves have some data inconsistencies such as the following:
PTB in the right upper field
I need three columns for each file such as - male, 40yrs, "PTB in the right upper field"
Can someone please support?