Swap number with a word

1 次查看(过去 30 天)
RG
RG 2018-3-7
回答: RG 2018-3-7
Hi all,
I am wondering how I could swap a number in a vector with a word. I have a vector from 1 to 100 ( linspace(1,100) ) and am trying to replace every fourth number with a word "height". Any suggestion on how to do this?
Thanks.

采纳的回答

Birdman
Birdman 2018-3-7
a=string(linspace(1,100));
a(4:4:end)=regexprep(a(4:4:end),'\d*','height')

更多回答(1 个)

RG
RG 2018-3-7
Excellent, thanks!

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by