Matlab error when I try to load a file
7 次查看(过去 30 天)
显示 更早的评论
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
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
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Other Formats 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!