Format specifiers for TEXTSCAN

I'm confused by the TEXTSCAN documentation regarding the format specifier. In the following call (from code I did not write, but need to understand),
data = textscan(textLine,'%f%f%f%f%*[^\n]');
I get that it will attempt to parse four floats, but what about the rest of the specifier?
If I'm reading the docs correctly, the '%*' means "skip the next field," but no width is given. So does this just skip characters until it encounters the first one excluded by the '[^\n]'? In other words, does this construction just mean "parse four floats, then ignore until end of line"?
Thanks in advance for any clarifications,
-AMM

 採用された回答

Walter Roberson
Walter Roberson 2020 年 5 月 3 日

1 投票

Yes, that is exactly what that construct means, 4 floats and then ignore to newline.
The newline itself would not be consumed by the format, but nearly all of the % specifiers skip leading whitespace so in practice that seldom makes a difference.

1 件のコメント

AMM
AMM 2020 年 5 月 3 日
Thank you Walter!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

製品

リリース

R2020a

質問済み:

AMM
2020 年 5 月 3 日

コメント済み:

AMM
2020 年 5 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by