Transform char variable to matrix
17 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Guido Pozzi
le 14 Fév 2020
Réponse apportée : Stephen23
le 15 Fév 2020
Hi, I have a cell variable that looks like this:

I'D like to know if there is a way to transform it into a matrix of this kind:
NewVar=[2 5; 2 3; 2 5];
Thanks
0 commentaires
Réponse acceptée
Walter Roberson
le 14 Fév 2020
tmp = {'002,005';'002,003';'002,005'};
NewVar = cell2mat(cellfun(@(S) sscanf(S, '%f,%f').', tmp, 'uniform', 0));
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!