フィルターのクリア

how can i put the elements of a character matrix in to another matrix?

1 回表示 (過去 30 日間)
Joseph
Joseph 2015 年 10 月 20 日
コメント済み: Joseph 2015 年 10 月 20 日
i have two arrays, A(57332*1) which is a character type array and consist of two Words:R and P. and B(57332*1) which is array of numbers. when i put A and B in to another matrix C(57332*2), it changes R and P to numbers 82 and 80 ! how can i put R and P as they are in to matrix C?

採用された回答

TastyPastry
TastyPastry 2015 年 10 月 20 日
Matlab will do this because it converts character array A into their respective ASCII values, P = 80, R = 82. In order to store non-homogeneous data types, you need to place the data into a cell array. You can do this by using num2cell() on your character array and your numerical array and concatenating the outputs together.
out = [num2cell(A) num2cell(b)];

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by