I have a following text file delimited with 'tabs', that contains both strings and decimal numbers. I want to read only numbers in the text file and plot a surface between [T2,DEPTH,respective values] as [X,Y,Z]?
Show older comments
Hole: 123A
Top: 78.67
T2 3.34 4.26 8.16 9.84 10.01
DEPTH 0 1 2 3 4
78.67 3.38 9.28 7.86 0.00 0.00
80.52 4.68 9.27 0.00 0.00 1.24
91.50 6.66 2.34 1.23 0.00 0.00
95.67 7.88 6.88 5.43 0.00 2.34
100.01 5.44 6.54 8.23 5.01 0.00
5 Comments
KRISHNA NISHCAL BHARATULA
on 1 Mar 2017
Edited: KRISHNA NISHCAL BHARATULA
on 1 Mar 2017
Rik
on 1 Mar 2017
Load the entire file and read the values with the C = textscan(chr,formatSpec) syntax of textscan.
KRISHNA NISHCAL BHARATULA
on 1 Mar 2017
Rik
on 1 Mar 2017
There must be some structure in your data, otherwise you couldn't make sense of it either. You could count the tabs in a row to figure out how many values there are on that line and assume that's the format for the entire file.
Maybe I'll take some time tomorrow to write up some code.
Accepted Answer
More Answers (0)
Categories
Find more on Text Files 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!