Value associate to a parameter in a text

1 view (last 30 days)
Jack
Jack on 9 Jul 2018
Commented: Jack on 9 Jul 2018
So I have a text file similar to the following:
DELZZ 3301.23
KUTY 4.32 SERI -0.023
I want Matlab to read the file and return values associate to each parameter (DELZZ, KUTY,SERI,...) Any suggestion?

Accepted Answer

Paolo
Paolo on 9 Jul 2018
Edited: Paolo on 9 Jul 2018
data = fileread('mytextfile.txt');
val = regexp(data,'(?<=\s)(-?\d*\.?\d*)(?=\s|$)','match');
  7 Comments

Sign in to comment.

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!