How to convert numbers to text

조회 수: 1 (최근 30일)
Tomaszzz
Tomaszzz 2024년 8월 5일
답변: Stephen23 2024년 8월 5일
Hi all,
I have a 15x 1 double where:
rows 1:5 = 0, and I want to change 0 to 'x'
rows 6:10 = 1, and I want to change 1 to 'y'
rows 11:15 = 2, and I want to change 2 to 'z'
Can you help please?

채택된 답변

Stephen23
Stephen23 2024년 8월 5일
v = fix((0:14)./5).'
v = 15x1
0 0 0 0 0 1 1 1 1 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
w = char(v+'x')
w = 15x1 char array
'x' 'x' 'x' 'x' 'x' 'y' 'y' 'y' 'y' 'y' 'z' 'z' 'z' 'z' 'z'

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by