How to change textscan to fscanf?
Show older comments
Hello,
I was just needing some help changing this textscan code to fscanf,
I know I need to add a range at the end ([1,inf]), but even after that i cant get it to work.
%opens and searches for a file under the variable name
fileID = fopen(filename);
%While loop scans lines for our desired text and filters out unwanted text until end of file
while ~feof(fileID)
d = fgetl(fileID);
Latitude = textscan(d,'<trkpt lat="%f" lon="%f">\n');
Longitude = textscan(d, 'long="%f">\n');
Elevation = textscan(d, '<ele>%f</ele>)\n');
Time = textscan (d, '<time>2020-02-01T%f:%f:%f3z</time>\n');
%sorts the extracted data into columns
mat = [mat; Latitude, Longitude, Elevation, Time];
end
Thanks
1 Comment
Walter Roberson
on 22 Oct 2022
Note: @Sarah attached a sample file at https://www.mathworks.com/matlabcentral/answers/1819315-how-to-import-a-gpx-file-without-using-gpxread#comment_2403540
Accepted Answer
More Answers (0)
Categories
Find more on Standard File Formats 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!