Convert string to a cell, array or matrix
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Alfonso Lopez
le 27 Nov 2015
Commenté : Alfonso Lopez
le 30 Nov 2015
Hi everyone,
I was wondering how I could convert an string to array or matrix.
Thanks very much.
0 commentaires
Réponse acceptée
Titus Edelhofer
le 30 Nov 2015
Hi Alfonso,
first of all, you might consider using the variable "NUM", since it already contains the numbers as double variable. So no need to convert anything. You usually use the RAW format, when the format of the EXCEl file changes, i.e., the indexing into NUM get's more complicated. If RAW(2:end, 65) contains only numbers (as numbers, not strings), probably simply doing
FaceRecall = cell2mat(RAW(2:end, 65));
or
FaceRecall = [RAW{2:end, 65}]';
should both work ...
Titus
2 commentaires
Titus Edelhofer
le 30 Nov 2015
But as I said, maybe
NUM(:, 65)
leads to the same ...
Titus
Plus de réponses (2)
Thorsten
le 27 Nov 2015
A string is a 1Xn matrix of type char
S = 'hallo';
You can convert it to a numerical matrix using
M = double(S);
If that is not what you want, please give us more details, and a sample string.
2 commentaires
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!