Swap number with a word
조회 수: 1 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
Birdman
2018년 3월 7일
a=string(linspace(1,100));
a(4:4:end)=regexprep(a(4:4:end),'\d*','height')
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!