help to convert text file symbol into array

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by