Clear Filters
Clear Filters

textread function parameters help

1 view (last 30 days)
MENGZE WU
MENGZE WU on 15 Dec 2021
Commented: Walter Roberson on 15 Dec 2021
Data = textread(fullfile(fNames(i).folder, fNames(i).name), '', -1, 'headerlines', 2);
I got this matlab code, however, I can't figure out what ' ', -1 part means. Could anyone help me with that?

Accepted Answer

Voss
Voss on 15 Dec 2021
As far as I can tell from reading the documentation for textread, those input arguments don't do anything special. They merely explicitly tell textread to do the default stuff ('' means don't skip any particular characters and -1 means read the whole file). It looks like the -1 can be omitted, but the '' (format specifier) needs to remain.
  1 Comment
Walter Roberson
Walter Roberson on 15 Dec 2021
Using '' as the format is an undocumented option. It causes textread() to examine the first line of input (after any skipped headers) to try to figure out what the format of the file is.
If I recall correctly, when '' is used for the format, and other undocumented parameters are not used, then the inputs must be numeric. At the moment I do not recall whether comma separators are supported in this mode.

Sign in to comment.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Tags

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!