Extracting data from strings with varying delimiters and column widths
Show older comments
I have read in the data as a single column array of strings and stripped out all the extra information and have each set of node temperatures seperated by a "--------------------" row.
My main trouble is dealing with the occurance that can be seen in the final line of this timestep where we have temperatures of 1000 or higher and the space disapears between the temeprature value and the node number and the node and temperature columns are different widths so can't be split by a single width.
Any help on solving this would be great
CONVERGENCE HAS BEEN OBTAINED.
=============================
TIME = 1646.00000
TOTAL TEMPERATURES.
--------------------
NODE TEMP. NODE TEMP. NODE TEMP. NODE TEMP. NODE TEMP.
1 98.7 2 98.7 3 91.6 4 91.6 5 85.1
6 85.1 7 79.2 8 79.2 9 73.8 10 73.8
11 68.8 12 68.8 13 64.3 14 64.3 15 60.0
...
346 20.0 347 20.0 348 20.0 349 20.0 350 20.0
351 110.2 352 110.2 353 312.0 354 312.0 355 582.7
356 582.7 357 753.4 358 753.4 359 854.4 360 854.4
361 932.8 362 932.8 363 999.5 364 999.5 3651050.0
3661050.0 3671087.7 3681087.7 3691117.9 3701117.9
3 Comments
Stephen23
on 27 Feb 2020
You should use readtable, which can parse fixed-width text files:
Read more on this feature:
Alastair Temple
on 27 Feb 2020
Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!