Sum of letters in matlab

15 次查看(过去 30 天)
googo
googo 2013-4-15
Asumming that I have a string = 'abcd'
and i want to sum 'a' and 'b' to be z = 'ab'... i guess a(1)+a(2) won't work...
so how can i do it?
basic thing to do but i'm new in matlab and just started to learn about strings.

回答(1 个)

Walter Roberson
Walter Roberson 2013-4-15
string(1:2)
or
[string(1), string(2)]
or
horzcat(string(1), string(2))

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by