Transform char variable to matrix
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Guido Pozzi
il 14 Feb 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 Commenti
Risposta accettata
Walter Roberson
il 14 Feb 2020
tmp = {'002,005';'002,003';'002,005'};
NewVar = cell2mat(cellfun(@(S) sscanf(S, '%f,%f').', tmp, 'uniform', 0));
0 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!