The approach described is well-suited for R2020b. Importing the OSM file into Driving Scenario Designer and exporting it as a MATLAB function is an effective way to access the road centers of individual roads. These centers can be later used to construct the bicycle's path. However, if the road network in the Driving Scenario Designer includes branches, as illustrated in the image below, identifying the coordinates for the specific roads that define the bicycle’s path may be challenging.
To simplify this process, I would recommended to include only the roads that correspond to the bicycle's intended path before exporting.
It is also important to note that the exported data will be in Cartesian coordinates, with the origin at the geo-referenced location. Use the following command to get more information on the coordinate systems used in Automated Driving Toolbox.
web(fullfile(docroot, 'driving/ug/coordinate-systems.html'))
As an alternative, starting from R2022b, the roadprops function is available for extracting road properties directly from an OSM file. Additional details can be found in the documentation:
The output of the roadprops function includes the road centers, which can be used to construct the bicycle’s route.