I need to separate text from value
Mostrar comentarios más antiguos
I need to separate the output of fscanf
current_amp =
:MEASUREMENT:IMMED:VALUE 35.0E-12
and only retain the number.
I would like to have the output only give me 35.0E-12.
I looked into using regexp, but it also separates the number to 35 12.
If anyone has any advice it would be greatly appreciated.
Best
Umar
Respuestas (1)
Jos (10584)
el 1 de Mzo. de 2016
str = ':MEASUREMENT:IMMED:VALUE 35.0E-12'
value = sscanf(str,'%*s %f')
4 comentarios
Jos (10584)
el 1 de Mzo. de 2016
or perhaps you can use fscanf directly using the file identifier:
value = fscanf(fid,'%*s %f')
Umar Twahir
el 1 de Mzo. de 2016
Editada: Walter Roberson
el 2 de Mzo. de 2016
Umar Twahir
el 1 de Mzo. de 2016
Jos (10584)
el 1 de Mzo. de 2016
Good to hear that. Solving a problem yourself is the best way to learn!
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!