Matlab reported an error when using function gpxread() that the file is not a gpx file?

7 ビュー (過去 30 日間)
Yuanyi Chen
Yuanyi Chen 2022 年 2 月 20 日
回答済み: Aniket 2025 年 5 月 7 日
I downloaded some track file in the format of GPX and tried to create a track figure with those gpx files, but matlab reported an error when executing the function of gpxread that the file is not a gpx file. The source of the gpx files is https://www.la-flamme-rouge.eu/, the gpx file is fine to be executed on a map on the website, but failed in matlab.
The gpx file is in version 1.1, with metadata tags.
The code and error is here. Need a solution:(
The gpx file is attached in a format of txt, changing the file format directly with renaming it to .gpx is available.
Need a solution:( badly:(
route = gpxread(['tokyo-2020-men-elite-itt.gpx']);
#错误使用 gpxread__ (1 )
#The file, "C:\Users\cyyyy\Downloads\gpx\tokyo-2020-men-elite-itt.gpx", is not a GPX file.
  1 件のコメント
veromora
veromora 2022 年 10 月 26 日
I also had the same problem, but solved it with the new function that can read those .gpx files. Since 2020 the function gpxread no longer works as it used to and you should use readgeotable instead.

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

回答 (1 件)

Aniket
Aniket 2025 年 5 月 7 日
I am able to reproduce the issue in MATLAB R2021a but not in R2020b.
The issue occurs because the GPX file does not specify a version or the namespace. Kindly add "version" to 2nd line of the file as shown below:
<gpx version="1.1" xmlns="http://www.topografix.com/GPX/1/1" ...>
Alternatively, as mentioned by @veromora, you may also use readgeotable function if it's a viable option.
Hope this resolves the issue!

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by