how do you combine character array and a row vector

3 ビュー (過去 30 日間)
Karolina
Karolina 2014 年 2 月 28 日
回答済み: Jacob Halbrooks 2014 年 2 月 28 日
Do you need to convert a num2str row vector into a column vector when combining that vector with a character array of the same size?
Ex: if your character array is: names=char('ellen','bobby','joe');
numb=[8,17,3] numbers=num2str(numb) when combining do you need to do : combo=(names, numbers') ?

回答 (1 件)

Jacob Halbrooks
Jacob Halbrooks 2014 年 2 月 28 日
You can use STRVCAT to add a row to your char matrix:
>> strvcat(names, numbers)
ans =
ellen
bobby
joe
8 17 3
That said, you might also consider using cell arrays to manage your strings instead to avoid this type of problem.

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by