How to convert array so that I have only numerical values
4 ビュー (過去 30 日間)
古いコメントを表示
I need to turn this array to a graph, to do so I only need numerical values
0 件のコメント
回答 (3 件)
Sriram Tadavarty
2020 年 11 月 2 日
Hi Pavan,
As from the snippet provided, i can see a pattern where from 6 element the numeric value starts and has till last but before element.
Assuming temp as a variable having that data. Here is the way it can be done
numericTemp = cellfun(@(x) str2num(x(6:end-1)),temp);
Hope this helps.
Regards,
Sriram
0 件のコメント
Ameer Hamza
2020 年 11 月 2 日
This is an alternative approach
str = {'lat: -30.963#';'lat: -30.963#';'lat: -30.963#';'lat: -30.963#'}
nums = cellfun(@(x) sscanf(x, 'lat:%f#'), str)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Directed Graphs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!