Transform char variable to matrix
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Guido Pozzi
el 14 de Feb. de 2020
Respondida: Stephen23
el 15 de Feb. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 14 de Feb. de 2020
tmp = {'002,005';'002,003';'002,005'};
NewVar = cell2mat(cellfun(@(S) sscanf(S, '%f,%f').', tmp, 'uniform', 0));
0 comentarios
Más respuestas (2)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!