I have created a text variable as;
Text = "Alex"
and I want to create an other text varible with every second letter of the "Text" varible(Alex). How can I do it?

 Akzeptierte Antwort

Chunru
Chunru am 30 Aug. 2022

0 Stimmen

% Use char array
Text = "Alex"
Text = "Alex"
Text1 = char(Text);
Text2 = string(Text1(1:2:end))
Text2 = "Ae"

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 30 Aug. 2022

Beantwortet:

am 30 Aug. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by