필터 지우기
필터 지우기

how to import data from a text file to MATLAB

조회 수: 2 (최근 30일)
jack knipler
jack knipler 2016년 4월 18일
답변: Rangan M K 2016년 5월 18일
Hey I need help with importing data from a text file to MATLAB. The text file has 2000 variables of time, latitude and longitude and i need help with how to import this data into a readable array inside MATLAB.
Thank you
  댓글 수: 3
jack knipler
jack knipler 2016년 5월 3일
Hi, we get a text file
like the one i have attached and are asked to determine a suitable way to read the data in matlab. There are also variables reaching 2000 seconds. Thank you
Hiskiel Stephanus
Hiskiel Stephanus 2016년 5월 3일
You would have to use the fscanf function in order to ensure that you do not read the associated text. Thereafter you can employ loop methods to separate you data into time,latitude and longitude respectively.

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

채택된 답변

Rangan M K
Rangan M K 2016년 5월 18일
readData=textread('YourFile.txt','%s')
This will remove the gap inbetween and give you all the data as strings. Once you get the string you can only take the required string for eg. The time data might be repeated in every 2nd ,9th, 16th etc with constant gap.
Use a for loop to get this data and use str2num to change it to a number.
Hope this solves your problem.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by