Converting a text file into strings and integers
13 views (last 30 days)
Paolo Binetti on 19 Dec 2016
I have .txt input files with a very simple structure, of which I attach an example. I want to convert its content in strings and integers. My code below works, but I was wondering if there is a faster option than "textread", which seems to be the weak point.
[pattern, text, d] = textread('dataset.txt', '%s %s %d');
pattern = cell2mat(pattern(1));
text = cell2mat(text(1));