Combining a character array and matrix
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Conner Carriere
am 10 Feb. 2021
Kommentiert: Conner Carriere
am 10 Feb. 2021
I was wondering if there was a way to combine a char array and a matrix
I have this character array
MwC =
9×1 char array
'w'
'b'
'y'
'b'
'w'
'r'
'y'
'r'
'b'
and this matrix
newcoords =
1
2
3
4
5
6
7
8
9
I have tried something like [newcoords, MwC] but that does not work and it outputs weird symbols
I need to be able to do something like
combined(1,2)= 'w'
I am ok with changing 'w' into a variable if that would work better
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 10 Feb. 2021
Your desired output is not clear.
MwC = [
'w'
'b'
'y'
'b'
'w'
'r'
'y'
'r'
'b'];
newcoords = (1:9).';
newcoords + string(MwC)
compose('%d %s', newcoords, MwC)
char(ans)
compose("%d %s", newcoords, MwC)
table(newcoords, MwC)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!