help to convert text file symbol into array

조회 수: 1 (최근 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 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