Extracting numeric values from character array
古いコメントを表示
Hi, I have a character array "coords" (containing 3D coordinates), which looks something like this:
val =
'[ 48. -24. 48.]'
'[ 50. -22. 58.]'
'[ 48. -20. 50.]'
I would like to find the index of a specific coordinate, something like:
find(coords == [50 -22 58])
How do I do that? Transforming coords as follows:
coords_num = str2double(coordinates)
just leads to:
coords_num = NaN
1 件のコメント
Paolo
2018 年 9 月 16 日
What is the output of
>> coords
?
採用された回答
その他の回答 (1 件)
Walter Roberson
2018 年 9 月 16 日
T = regexp( regexprep(coordinates, '\[|\]', ''), 'split') ;
coords_num = str2double(T) ;
3 件のコメント
MiauMiau
2018 年 9 月 16 日
Walter Roberson
2018 年 9 月 16 日
Use cellstr(coordinates) where I had coordinates()
MiauMiau
2018 年 9 月 17 日
カテゴリ
ヘルプ センター および File Exchange で String についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!