I have a list of coordinates in a column, ex. ‘43.7N’ and I want the column to just be the numerical value, for example ‘43.7’. How can I eliminate the letter at the end?

1 个评论

Can you attach the list as a .mat file so we can see how the data is structured?

请先登录,再进行评论。

 采纳的回答

One approach —
Coords = cell2mat(compose('%.1fN',rand(1,5)*100).') % Create Column
Coords = 5×5 char array
'71.0N' '75.8N' '70.1N' '63.5N' '82.8N'
ReadNrs = cell2mat(textscan(Coords.','%fN')) % Read Column
ReadNrs = 5×1
71.0000 75.8000 70.1000 63.5000 82.8000
whos Coords ReadNrs % Check Variables
Name Size Bytes Class Attributes Coords 5x5 50 char ReadNrs 5x1 40 double
.

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Data Type Conversion 的更多信息

产品

版本

R2021a

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by