mercredi 4 mars 2015

read a number after a specific string in a txt file


Vote count:

0




i know this question is here very often, but i cant solve this and i would appreciate your help. I have .txt file and i am looking for specific string - e.g. value and then copy a number behind that to a matlab memory.


example



  1. row1

  2. row2

  3. pressure 95.8 %there could be more white-space characters between string and numbers and in every cycle there is different value:1.cycle 95.8>>next cycle 1009.6543>>..., but its always in this format


I tried this


fid = fileread('search.txt')


value = regexpi(fid, '(?<=pressure\s*)\d*', 'match')


but it saved just '95' instead of '95.8' thanks, for any help



asked 3 mins ago







read a number after a specific string in a txt file

Aucun commentaire:

Enregistrer un commentaire