Is it possible to put a character into a matrix?
Mostra commenti meno recenti
I'm trying to do this
m1 = [1, 2, 3, 4, 5, 6, 7];
m2 = 'A';
m1(3) = m2;
so that m1 will be
[1, 2, A, 4, 5, 6, 7]
Instead of what I actually get.
[1, 2, 65, 4, 5, 6, 7]
Risposta accettata
Più risposte (1)
Star Strider
il 1 Apr 2016
2 voti
You cannot mix numeric and character values in a numeric array. You can do it with a cell array, but it’s only good for storing the values. You would encounter the same problem if you wanted to calculate with it.
Categorie
Scopri di più su Matrices and Arrays in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!