help to convert text file symbol into array

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Stephan
Stephan il 20 Ago 2019
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'
':'

Più risposte (1)

Furat Alobaidy
Furat Alobaidy il 20 Ago 2019
Thanks a lot for helping.

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by