How to use text scan?

5 ビュー (過去 30 日間)
Ibro Tutic
Ibro Tutic 2015 年 11 月 4 日
回答済み: TastyPastry 2015 年 11 月 4 日
I need to read serial numbers from many .csv files. Within these files, the serial number located in the first column, second row, and is of the form Eng SN = XX0000X000000. What I need to read is just the serial number, and not the Eng SN portion, so everything after the = sign. To clarify, in the serial numbers, the X is just a place holder for some other letter and the 0 is a place holder for some other number. I know I will need to use fopen, fclose etc. I am just stuck on what format spec to use since there is a mixture of letters and numbers.

採用された回答

TastyPastry
TastyPastry 2015 年 11 月 4 日
You can use
textscan(fileID,'%s %s %s %s');
That will read all your data in. Only the last entry will matter, since those are the serial numbers.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by