string to character array

조회 수: 38 (최근 30일)
amna chaudhary
amna chaudhary 2018년 4월 15일
댓글: amna chaudhary 2018년 4월 15일
I have converted a string array to a character array
c = cellstr(bb)
d = char(c)
when i index variable d, it gives me vertical characters instead of horizontal. for example i have a character string 'ATG' and another 'GCB'. d(2) should give me 'T' but it gives me 'G'. PLEASE HELP ME FIGURE IT OUT.

채택된 답변

Walter Roberson
Walter Roberson 2018년 4월 15일
This is expected if you only give one subscript for the array. Remember that arrays in MATLAB are stored "down the columns". The first entry in memory is d(1,1), the second entry in memory is d(2,1), and so on until d(end,1) followed by d(1,2), d(2,2), d(3,2) and so on.
If you want entire rows, then d(1,:), d(2,:) and so on.
  댓글 수: 1
amna chaudhary
amna chaudhary 2018년 4월 15일
thanks a lot for the help :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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