string to character array
38 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!