Matlab error when I try to load a file

7 次查看(过去 30 天)
Lil
Lil 2013-6-26
Hi all,
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)
Could someone help me please ?
Thank you
[Merged from duplicate]
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
  2 个评论
Walter Roberson
Walter Roberson 2013-6-26
If you were working by hand, how would you convert a distance "in degrees" to kilometers?
My speculation would be that you have several entries for the same earthquake, and you need to triangulate between the readings in order to convert the angle measurements into distances.

请先登录,再进行评论。

回答(4 个)

Walter Roberson
Walter Roberson 2013-6-26
When you use load() of a .txt file, the file must be in save -ASCII format. In that format, text can only appear following comment markers. You will need to use a different routine to load files with the format you describe.

Lil
Lil 2013-6-26
Thank you , Which routine should I need for loading the files?I don't know how to do that..:(

Lil
Lil 2013-6-26
Sorry, I didn't see the link you put...I will see that ..Thank you

Lil
Lil 2013-6-26
I have to convert the time HH:MM:SS to seconds and the distance in degree in kilometre.By doing that I can't any more convert my HH:MM:SS..Is there a method to do that with the cells?

标签

Community Treasure Hunt

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

Start Hunting!

Translated by