Combining a character array and matrix
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Conner Carriere
el 10 de Feb. de 2021
Comentada: Conner Carriere
el 10 de Feb. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 10 de Feb. de 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)
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!