How can I insert a specific number in a specific position of a sequence?

조회 수: 5 (최근 30일)
Hello. There is a long sequence of number. for example, '100023000'. I want to insert a number '1' in a 5th position of above sequence. That is, between 2 and 3, resulting in a final sequence of '1000213000'.
How can i make it possible?
Please help me!

채택된 답변

TAB
TAB 2012년 3월 12일
Seq = '100023000';
Pos = 6;
NewSeq = [Seq(1:Pos-1) '1' Seq(Pos:end)];

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by