How Do I Replace Numbers with Alphabets
조회 수: 7 (최근 30일)
이전 댓글 표시
I'm learning MATLAB and I want to know how i can change my code so instead of using:
n = 1:6 which displays '1, 2, 3, 4, 5, 6' and loops, for i = 1:n, which loops number sequence,
How do I substitute these with letters like "ABCDEF" or even a word such as "FORMAT"
댓글 수: 0
답변 (2개)
Star Strider
2022년 11월 21일
Use arrays —
w1 = {'A','B','C','D','E','F'};
w2 ='ABCDEF';
w3 = ["F","O","R","M","A","T"];
for k = 1:6
L1{k,:} = w1{k}
end
for k = 1:6
L2{k,:} = w2(k)
end
for k = 1:6
L3{k,:} = w3(k)
end
Lic = cat(2,L1{:})
L2c = cat(2,L2{:})
L3c = cat(2,L3{:})
.
참고 항목
카테고리
Help Center 및 File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!