Easy textscan question. What is this input?

1 回表示 (過去 30 日間)
Andrew Reibold
Andrew Reibold 2014 年 7 月 17 日
コメント済み: Andrew Reibold 2014 年 8 月 5 日
I have inherited a script with many textscan functions like the one below
textscan(fid, '%*s %*s %f\n\r',1,'HeaderLines',19)
So this skips 19 lines, then reads and ignores two strings and then finds the next number and returns it and ignores the rest of the line, right?
But what does the '1' do? Does that serve any purpose? Is that how many times to repeat the operation? That seems pointless if the number is one, and I have many of these with '1's...
  2 件のコメント
Sara
Sara 2014 年 7 月 17 日
Yes, 1 is the number of times it repeats the ignore 2 strings, read number instruction
Andrew Reibold
Andrew Reibold 2014 年 7 月 17 日
Ok, thats what I originally thought but it seemed pointless and I usually use 'fgetl' so I wasn't familiar with textscan.
Thanks for confirming. If you want to add comment as an answer I will accept to give you credit and so it doesn't pop up as unanswered.

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

採用された回答

Sara
Sara 2014 年 7 月 17 日
Yes, 1 is the number of times it repeats the ignore 2 strings, read number instruction. You can use fgetl to read one line at a time, but with textscan you can read something that's a mix of strings and numbers and extract only what you care about.
  1 件のコメント
Andrew Reibold
Andrew Reibold 2014 年 8 月 5 日
Thanks Sara. This helped me

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by