I need a function or equivalent code fgetl, but it is very fast.
조회 수: 7 (최근 30일)
이전 댓글 표시
This is slowing down my code, at some point it takes 10 seconds per iteration in this function only.
댓글 수: 0
답변 (1개)
Steven Lord
2021년 9월 21일
Are you sure that fgetl is what's taking the time? Or are you trying to read data one line at a time from a file and storing each line in turn in a cell array, and if so is growing the cell array the bottleneck? Can you show a bit of context for your fgetl call?
If you just want to read in data all at once, try fileread. You'd need to split it into its constitutent lines if you wanted to process a line at a time, but at least you'd only perform file I/O once.
t = fileread('bench.dat');
t(1:80)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!