Info
This question is closed. Reopen it to edit or answer.
Convert HH:MM:SS to secondes and distances in degrees in kilometers
1 view (last 30 days)
Show older comments
Hi all,
I posted a message a few minutes ago about an message error I got:
I loading a file called: A=load('epitime.txt') and I always get this error message:
??? Error using ==> load Unknown text on line number 1 of ASCII file C:\Users\Liliane\Documents\MATLAB\stage usa\temps_distance\epitime.txt "ARU".
Error in ==> code_temps_distance_filtre4 at 5 A=load('epitime.txt');
Initially my file has the extension epitime.fil4 and I got the same message error so tried with epitime.txt,but I make no difference.
My file consist in columns like this :
ARU 2.2888 03:23:14 (distance) (HH:MM:SS)
I got an answer that I should use textscan,so I did it :
clc
clear all
close all
%loading data
fileID = fopen('epitime.txt');
C = textscan(fileID, '%s %f %s %f')
fclose(fileID);
celldisp(C)
%epicentral distance in°
dis=C(:,2);
%time in HH:MM:SS
time=C(:,3);
%distance in kilometer
dis_km=dis*111.12
%time in Secondes
but the problem is now that I can't convert the time HH:MM:SS in my file to seconds and my distance in degrees can't be converted in kilometres,too. What should I do ?I don't know any more what to do..I'm completely lost :(
Thank you
1 Comment
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!