I am trying to read a comma delimited text file but there is information missing on my results.
The following is an extract of my text file:
number,datetime start,datetime arrive
4027,25/03/2016 11:20,25/03/2016 11:20
4000,25/03/2016 11:20,25/03/2016 11:20
4027,25/03/2016 11:21,25/03/2016 11:21
4000,25/03/2016 11:21,25/03/2016 11:21
My code:
file = fopen('myfile.txt');
TextCell=textscan(file,'%s');
Text=TextCell{1};
fclose(file);
containsStr = ~cellfun('isempty',strfind(Text,'4027'));
FilteredText=Text(containsStr); % filters the strings that contain 4027
Results obtained:
4027,25/03/2016
4027,25/03/2016
Results expected:
4027,25/03/2016 11:20,25/03/2016 11:20
4027,25/03/2016 11:21,25/03/2016 11:21
Where is my mistake?