cell array with numeric values only
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Pavan Singh
el 2 de Nov. de 2020
Comentada: Pavan Singh
el 2 de Nov. de 2020
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/399439/image.png)
Conver this array to an array with numbers only so it can be used for a graph
0 comentarios
Respuesta aceptada
Más respuestas (2)
Stephen23
el 2 de Nov. de 2020
Do NOT use loops or cellfun for this, unless you really want to write complex and slow MATLAB code.
The most efficient solution is to use sscanf like this:
C = {'long: 151.125#';'long: 151.126#'};
V = sscanf([C{:}],'long:%f#')
0 comentarios
Akira Agata
el 2 de Nov. de 2020
Another possible solution:
C = {'long: 151.125#';'long: 151.126#'};
V = regexp(C,'[?\d.]+','match','once');
V = str2double(V);
>> V
V =
151.1250
151.1260
0 comentarios
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!