Improve speed reading in a .dat file
조회 수: 6 (최근 30일)
이전 댓글 표시
Im attempting to process some rather heafty .dat files with 500k+ lines. The bulk of my code runtime is being taken up by two functions
fgetl and str2double
Does anyone know a faster way to read in a dat file or functions that run faster
댓글 수: 2
Stephen23
2021년 3월 4일
If at all possible, the fastest would be
but whether you can use it depends on the file format, which you have not told us anything about.
If you want further help with this, upload a representative** file by clicking the paperclip button.
** This means exactly the same file format, EOL characters, delimiter, number formats, etc., but small enough so that you can upload it on this forum. Probably you achieve this by keeping only the first few hundred lines.
답변 (2개)
Image Analyst
2021년 3월 4일
You could try fileread() to read in the whole file into one variable in one shot, then go through it parsing it.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!