フィルターのクリア

Dealing with character array

7 ビュー (過去 30 日間)
Yongmin
Yongmin 2014 年 12 月 26 日
コメント済み: Star Strider 2014 年 12 月 26 日
Hello!
I have a character array, for example, A (m x n). In this array, each character is an element of m x n matrix.
However, I want to deal with this array as m row vectors of n elements each, i.e. m strings of n characters. How can I access the row vector instead of using A(1,:)? I'd like to know what kind of data type can be used to access a string of characters?
Many thanks!

採用された回答

Star Strider
Star Strider 2014 年 12 月 26 日
I’m not sure I understand what you want to do, but the cellstr function might work:
A = ['a' 'b' 'c'; 'd' 'e' 'f'; 'g' 'h' 'i'];
C = cellstr(A);
C1 = C{1}
  2 件のコメント
Yongmin
Yongmin 2014 年 12 月 26 日
Thanks a lot! "cellstr" function works for me.
Star Strider
Star Strider 2014 年 12 月 26 日
My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by