cell array with numeric values only
2 次查看(过去 30 天)
显示 更早的评论
![](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 个评论
采纳的回答
更多回答(2 个)
Stephen23
2020-11-2
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 个评论
Akira Agata
2020-11-2
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!