如何将矩阵转换为字符串数组:

2 views (last 30 days)
SM
SM on 9 May 2021
Commented: SMon 2 Jul 2021
I have a matrix:
R=[1 2 1 3 2 3 1;1 1 2 1 2 2 3];
that i want to convert to:
Q=["A11","A21","A12","A31","A22","A32","A13"];
How can I do that?
Appreciated!

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 9 May 2021
"A"+ R(1,:)' + R(2,:)'
4条评论

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 9 May 2021
R=[1 2 1 3 2 3 1;1 1 2 1 2 2 3]
r = 2×7
1 2 1 3 2 3 1 1 1 2 1 2 2 3
compose("A%d%d", R(1,:).', R(2,:).').'
ans =1×7 string array
"A11" "A21" "A12" "A31" "A22" "A32" "A13"
1 Comment
SM
SM on 9 May 2021
You are awesome! Thank you.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!