Read Garmin .fit file function
66 views (last 30 days)
Show older comments
I already saw a question related on this topic of 2018 but I was wondering if in the meantime someone wrote a function to read directly on Matlab .fit files from Garmin.
I cannot use the gpx file because it only exports GPS informations, while fit file has everything of an activity inside of it and I want to do some post processing on these info.
For the moment a workaround I found is to use the external software Golden Cheetah that already does post processing. It's a complete software but quite heavy. I use it only to convert fit into csv and read them on matlab.
An internal function would it great. Fit files are not text file like gpx, but are encrypted. I guess it is possible to decrypt it (found a Garmin java script, but it has some problems in the conversion) because I don't think the format is protected by copyright.
0 Comments
Accepted Answer
Star Strider
on 2 May 2024
@Gabri — According to the information in the Programming Languages section of the links you provided (thank you), the SDK supports Python. Since MATLAB also does (see: Python with MATLAB) I suggest that as the way to go with this project. Those files are binary files, and the format is not going to be easy to work with, since that would involve writing your own MATLAB code to read them, especially since the necessary information (precision, machine format and such) does not appear to be provided in the Garmin documentation.
This is going to be a challenge. When you get your code working, please contribute it to the File Exchange.
2 Comments
Star Strider
on 2 May 2024
As always, my pleasure!
I have not had any reason to use Python so far, however there have been several Answers posts about it, so I explored it. Apparently, some things are easier to do in Python than MATLAB, and like Garmin, there appear to be other SDKs using Python that involve instrumentation interfacing and similar capabilities.
More Answers (1)
Sachin Lodhi
on 2 May 2024
Edited: Sachin Lodhi
on 2 May 2024
Hello Gabri,
I understand that you want to read a Flexible Image Transport System (FITS) file in Matlab. For this, you can use the 'fitsread' function. The 'fitsread' function reads the primary data of the FITS file and returns it as an adjusted array. The function replaces undefined data values with 'NaN' and scales numeric data by the slope and intercept values, always returning double precision values.
The 'fitsread' function facilitates the retrieval of raw data from FITS files, enables the extraction of subsamples of data, and permits the reading of data from designated columns within a FITS file, among other functionalities.
Here is a sample code snippet that uses 'fitsread' function to read data from 'filename.fits' file.
data = fitsread('filename.fits');
I recommend you to please go through the following documentation for more information on 'fitsread' function -
See Also
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!