I have a text file FILE1.txt which has data logged in the format specified.
[39645212,-79970785]35892002323232[0.0][39645212,-79970785]35892002323232[12.2]
I would like to load this data into a matrix of size 2*4. I tried using dlmread which throws me errors. I am trying to get something using textread. How can I get something like:
39645212 -79970785 35892002323232 0.0
39645212 -79970785 35892002323232 12.2
Lets try using
regexpNOTES:
I assume no spaces and only numbers are between the ‘[‘, ‘]’ and ‘,’. So I can use
str2doubleon the recovered strings.I did not pre-allocated
mat– this is bad practice and can significantly reduce performance. See this question for details on how to pre-allocate.