Fastest way of opening a text file and converting it to a matrix?

조회 수: 3 (최근 30일)
Alex
Alex 2024년 3월 29일
답변: Walter Roberson 2024년 3월 29일
I currently have a large amount of text files i want to convert to matrices, each text file will have the same structure. I am currently using readmatrix but just opening and reading a few takes too long. Is there a faster way?

답변 (2개)

Rik
Rik 2024년 3월 29일
doc fscanf
If you know the format, using that knowledge always improves speed, since the more complicated tools don't need to spend time figuring out the file structure.

Walter Roberson
Walter Roberson 2024년 3월 29일
If your file happens to be just a rectangular block of numbers, with either blank or comma between them, then the fastest approach is to load() the file.
If your file happens to be some other form, then the fastest approach depends on the details.

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by