Converting each matrix entry to specific string
3 ビュー (過去 30 日間)
古いコメントを表示
Muhammad Ali Qadar
2013 年 11 月 17 日
編集済み: Azzi Abdelmalek
2013 年 11 月 17 日
hi,
I have matrix
A=[1 2 3;4 5 6; 7 8 9]
I wanted to convert each matrix entry to specific string for example
A=[X(1) X(2) X(3);X(4) X(5) X(6); X(7) X(8) X(9)]
Any Suggestion Please!!!
2 件のコメント
採用された回答
Azzi Abdelmalek
2013 年 11 月 17 日
arrayfun(@(ii) X(ii),A,'un',0)
5 件のコメント
Azzi Abdelmalek
2013 年 11 月 17 日
A=[1 2 3;4 5 6; 7 8 9];
arrayfun(@(ii) sprintf('X(%d)',ii),A,'un',0)
Azzi Abdelmalek
2013 年 11 月 17 日
編集済み: Azzi Abdelmalek
2013 年 11 月 17 日
%or
sprintf([repmat('X(%d) ',1,size(A,2)) '\n'],A')
その他の回答 (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!