フィルターのクリア

FormatSpec for mixed entry of Input

1 回表示 (過去 30 日間)
Nidhi SRIVASTAVA
Nidhi SRIVASTAVA 2017 年 6 月 29 日
回答済み: dpb 2017 年 6 月 29 日
I am using textscan to read a file. The data of file is something like:
ASC2007252381128.0000.T88.ch04.sac E
ASC2007252381128.0000.T90.ch04.sac A
and so on.
I am having problems in defining formatspec to be used in textscan. I tried reading it by using fileread which converts it into a string array of single cell. I wish to obtain just the string before a blank i.e,
ASC2007252381128.0000.T90.ch04.sac,ASC2007252381128.0000.T88.ch04.sac
and so on. Can anybody please help me with the problem? Thanks

採用された回答

dpb
dpb 2017 年 6 月 29 日
>> s='ASC2007252381128.0000.T88.ch04.sac E'; % sample input record
>> fmt='%s %*s'; % read a string, skip a string
>> textscan(s,'%s %*s') % read it..
ans =
{1x1 cell}
>> ans{:}
ans =
'ASC2007252381128.0000.T88.ch04.sac'
>>

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by