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!