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 件のコメント

Turlough Hughes
Turlough Hughes 2022 年 1 月 4 日
Can you attach the list as a .mat file so we can see how the data is structured?

サインインしてコメントする。

 採用された回答

Star Strider
Star Strider 2022 年 1 月 4 日

0 投票

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 ExchangeData Type Conversion についてさらに検索

製品

リリース

R2021a

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by