フィルターのクリア

help to convert text file symbol into array

2 ビュー (過去 30 日間)
Furat Alobaidy
Furat Alobaidy 2019 年 8 月 20 日
回答済み: Furat Alobaidy 2019 年 8 月 20 日
Hi i have this text file :
4c07b] IF hit state: 5 (S) valid: 1 writable: 0 readable: 1 dirty: 0 tag: 260
243240500: system.cpu00.icache: ReadReq [4c078c:4c078f] IF hit state: 5 (S) valid: 1 writable: 0 readable: 1 dirty: 0 tag: 260
243241000: system.cpu00.icache: ReadReq [4c0780:4c0783] IF hit state: 5 (S) valid: 1 writable: 0 readable: 1 dirty: 0 tag: 260
How convert each symbole in row into array ?
for example :
4c07b] IF ==== 4 = i[1,1]
c=i[1,2]
0= i[1,3]
7= [1,4]
b=i[1,5]
] =i[1,6]
....m

採用された回答

Stephan
Stephan 2019 年 8 月 20 日
Assuming you import this as a string, you could use:
a = "4c07b] IF hit state: 5 (S) valid:"
b = char(a)
c = b(:)
which gives:
c =
33×1 char array
'4'
'c'
'0'
'7'
'b'
']'
' '
'I'
'F'
' '
'h'
'i'
't'
' '
's'
't'
'a'
't'
'e'
':'
' '
'5'
' '
'('
'S'
')'
' '
'v'
'a'
'l'
'i'
'd'
':'

その他の回答 (1 件)

Furat Alobaidy
Furat Alobaidy 2019 年 8 月 20 日
Thanks a lot for helping.

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by