add character cells arrays

3 次查看(过去 30 天)
best16 programmer
best16 programmer 2016-11-22
we have a character cell [d d d d] and [d -d d -d]. how can we get [d+d d-d d+d d-d].

回答(1 个)

Walter Roberson
Walter Roberson 2016-11-23
first = {'d', 'd', 'd', 'd'};
second = {'d', '-d', 'd', '-d'};
result = regexprep(strcat(first(:), {'+'}, second(:)), '+-', '-').' ;

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by