Can I extract data from file without importing?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hey There!
I believe this is a simple answer, but I just cannot find it online anywhere.
I have a series of .dat files that I am utilizing that are substantial in size, of the order of about 800,000 numbers in a single column format.
What I need to do is consider the first .dat file in the series, extract three specific values within the single column, discard it and then move on to the next .dat file in the series, do the same, and so on...
I have no problem doing this using the importdata(blah blah.dat) method, however each time I do this I import the entire data set to my workspace (I have 600 .dat files in the series) and so it takes forever.
My questions is, can I simply "cherry pick" the three specific data points from the single column without importing the entire data set within the .dat file??
Or any comments as to how to reduce time while mass importing would be great.
Thanks in advance
-Kyle
댓글 수: 2
채택된 답변
Image Analyst
2013년 5월 9일
You can use fgetl() and then quit reading the file once you recognize that you have the 3 numbers that you need.
댓글 수: 2
Image Analyst
2013년 5월 9일
You can use fseek to home in on the likely starting position. That will speed it up.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Data Preparation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!