readline.m v4.0

Reads the specified line(s) from a file.
다운로드 수: 4.7K
업데이트 날짜: 2016/1/1

라이선스 보기

USAGE:
% Reads the first line (default)
s = readline('data.txt');
% Reads the 8th line
s = readline('data.txt',8);

% Reads the [1 2 4 8] lines
s = readline('data.txt',[1 2 4 8]);
% Reads last 7 lines
s = readline('data.txt',[-7; -1]);
% Or just, reads the whole file
s = readline('data.txt','all');

NOTES:
In general, the output is a cell of strings. You may force a string matrix output with a third argument
s = readline('data.txt','all','string');

인용 양식

Carlos Adrian Vargas Aguilera (2024). readline.m v4.0 (https://www.mathworks.com/matlabcentral/fileexchange/20026-readline-m-v4-0), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2014b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Low-Level File I/O에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
4.0.0.0

V4.0 Now accepts 'all' input. Uses TEXTSCAN instead of TEXTREAD.

1.1.0.0

V3.0 Rewritten code. Negative NLINES values now indicated number of line from the End-of-File, instead of from the last line. New pairwise optional inputs for TEXTSCAN.

1.0.0.0

1. I change the loops of FGETL by a single TEXTREAD function as suggested by Urs (us) Schwarz.

2. New easy way for the lines inputs. Now accepts ascending and descending (negative) ranges.

3. I eliminate the file identifier input.