文字列の行列を作りたい。

조회 수: 32 (최근 30일)
パンダ
パンダ 2021년 11월 19일
답변: Hernia Baby 2021년 11월 19일
文字列の行列をfor文で作りたいです。具体的に言うと縦7500横1で1から2500までnomal,2500から5000までright,5001から7500までleftという文字を入れたいです。

채택된 답변

Hernia Baby
Hernia Baby 2021년 11월 19일
string型なら足し算でいけます
str = ("Sample"+char('0'+(0:60)'));
str(1:20)=str(1:20)+"normal";
str(21:40) = str(21:40)+"right";
str(41:60) = str(41:60)+"left";
str(1:5)
ans = 5×1 string array
"Sample0normal" "Sample1normal" "Sample2normal" "Sample3normal" "Sample4normal"
str(21:25)
ans = 5×1 string array
"SampleDright" "SampleEright" "SampleFright" "SampleGright" "SampleHright"
str(41:45)
ans = 5×1 string array
"SampleXleft" "SampleYleft" "SampleZleft" "Sample[left" "Sample\left"

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 データ型の変換에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!