Merge vector and array into one array

1 次查看(过去 30 天)
Hey
I want to merge a cell array with a vector. In the cell array I have text and the vector contains numbers. So what I want is to merge them like this:
Q = (Blabla1, blabla2, blabla3, ...)
T = (1.52, 1.78, 1.67 ...)
QT ="row 1" Blabla1, blabla2, blabla3, ...
"row 2" 1.52, 1.78, 1.67 ...
Thanks in advance!

采纳的回答

Matt J
Matt J 2014-5-5
编辑:Matt J 2014-5-5
This might be an example of what you want,
>> Q={'dog', 'cat'};
T=[1,2];
>> QT=[Q;num2cell(T)]
QT =
'dog' 'cat'
[ 1] [ 2]
  1 个评论
Kasper
Kasper 2014-5-5
QT=[Q;num2cell(T)] did the trick ! My Q and T was already filled with data, so QT=[Q;num2cell(T)] was all I needed. Thank you!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by