How to produce a series of strings?

조회 수: 2 (최근 30일)
sia ben
sia ben 2018년 7월 6일
댓글: OCDER 2018년 7월 6일
I want to produce a matrix of strings. Columns are marked as numbers (0 1 2 3 4 ...) and rows as letters (A B C D ...) the matrix shows as: [A0, A1, A2, A3, ...; B0, B1, B2, B3, ...; C0, C1, ....; ....] How should I done it?

채택된 답변

Sean de Wolski
Sean de Wolski 2018년 7월 6일
string(('A':'E')')+(1:5)
  댓글 수: 3
Sean de Wolski
Sean de Wolski 2018년 7월 6일
편집: Sean de Wolski 2018년 7월 6일
Hi Ocder,
I can, but it would actually sound better and be more likely to be acted on coming from you(!). File a simple tech support enhancement request through the support center or MATLAB desktop with your wishes. Dev/Doc is more likely to listen to customers than pesky application engineers :)
OCDER
OCDER 2018년 7월 6일
Haha. Sounds fair. I'll go ahead and send in a request.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

OCDER
OCDER 2018년 7월 6일
STR = strings(10, 10);
for r = 1:10
for c = 1:10
STR(r, c) = string(char(('A'+r-1))) + (c-1);
end
end

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by