Uttara
Uttara

Reputation: 125

extracting part of specific line from csv in MATLAB

I have a csv file with the third line as c 150. I can read the line using

c_raw = rawData(3, 1)

The output in this case is 'c 150'. I'm not sure how to code it so that I get only 150 as a numeric value.

Upvotes: 0

Views: 50

Answers (1)

JEdV
JEdV

Reputation: 5

if possible you can post process the input using regexp.

c = regexpi(c_raw, '\s(\d+)', 'tokens')
str2num((c{:}{:}))

hope this helps.

Upvotes: 1

Related Questions