Data extraction from txt with special format

조회 수: 2 (최근 30일)
Win co
Win co 2014년 10월 1일
댓글: Win co 2014년 10월 2일
Hello,
Given a following .txt file with 5 columns delimited by tab, I have difficulty at extracting these data in a matrix (double) where the 3rd column contains converted values in seconds.
ID DDD HH:MM:SS.mmmuuun PARA1 PARA2
1 0 01:05:04.9941480 0.0131 0.0000
In this example, in my matrix, the 3rd column has to be 1*3600+5*60+4.9941480. Could anyone help me to solve it please? Best regards, Winn

채택된 답변

Image Analyst
Image Analyst 2014년 10월 1일
Try the readtable() function:
t = readtable(fullFileName);
If that doesn't work, try textscan().
  댓글 수: 1
Win co
Win co 2014년 10월 2일
Thanks for your recommendation. I'm using Maltab2012b, "readtable" function does not exist. I've figured out how to solve this problem with textscan, maybe not optimal but it works as I wish. In sum, I seperate numeric data and string data. With the last one, I convert to numeric value.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by