How to extract the dat from the txt file?

2 views (last 30 days)
Pengju
Pengju on 19 Sep 2014
Commented: Pengju on 19 Sep 2014
Dear all,
I want to extract the data from this txt file (single row txt file ):
  • TOF(0.0055171 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551713 usec)
  • TOF(0.0055171 usec)
  • TOF(0.0055171 usec)
  • TOF(0.00551713 usec)
  • TOF(0.00551709 usec)
  • TOF(0.00551709 usec)
  • TOF(0.00551711 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551709 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551713 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551709 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551709 usec)
  • TOF(0.00551712 usec)
  • TOF(0.0055171 usec)
  • TOF(0.0055171 usec)
  • TOF(0.00551712 usec)
  • TOF(0.00551712 usec)
would you please give me some tips?

Accepted Answer

Pratik Bajaria
Pratik Bajaria on 19 Sep 2014
Hello,
Please go through the following link and its associated functions.
Please let me know in case of any doubts, hope it helps.
Regards, Pratik
  1 Comment
Pengju
Pengju on 19 Sep 2014
Dear Pratik,
Thanks a lot.
My code is: fileID = fopen('y_position_100eV_90degree_45degree.txt','r'); formatSpec = '%f'; A = fscanf(fileID,formatSpec) fclose(fileID);
where my txt file likes:
  • Y(21.0661 mm)
  • Y(21.7606 mm)
  • Y(23.0579 mm)
  • Y(23.6222 mm)
  • Y(23.1708 mm)
  • Y(23.3017 mm)
  • Y(21.0909 mm)
  • Y(23.4532 mm)
  • Y(24.1168 mm)
  • Y(24.1302 mm)
  • Y(24.9046 mm)
  • Y(21.8422 mm)
  • Y(22.1112 mm)
  • Y(23.0313 mm)
  • Y(23.6408 mm)
  • Y(24.3241 mm)
  • Y(23.2169 mm)
  • Y(24.481 mm)
  • Y(22.5371 mm)
  • Y(21.6923 mm)
  • Y(21.4646 mm)
  • Y(24.2505 mm)
  • Y(22.105 mm)
  • Y(22.713 mm)
  • Y(22.1005 mm)
  • Y(22.7714 mm)
  • Y(22.8956 mm)
  • Y(22.2155 mm)
  • Y(20.9683 mm)
  • Y(21.0251 mm)
  • Y(22.2097 mm)
  • Y(21.5413 mm)
  • Y(24.241 mm)
  • Y(24.2756 mm)
  • Y(23.529 mm)
  • Y(22.9066 mm)
  • Y(21.5241 mm)
  • Y(24.5771 mm)
  • Y(21.0303 mm)
  • Y(21.9809 mm)
  • Y(24.7471 mm)
  • Y(23.5962 mm)
but, the array A=[]...........

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!