Combining a character array and matrix
12 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Conner Carriere
il 10 Feb 2021
Commentato: Conner Carriere
il 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 Commenti
Risposta accettata
Walter Roberson
il 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)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!