how to import data from a text file to MATLAB
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
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
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!