Please I want to read a mgd. file with a source code, please I need help. I will send you the source code and the mgd.file too. Thank you

4 次查看(过去 30 天)
Please I want to read a mgd. file with a source code, please I need help. I will send you the source code and the mgd.file too. Thank you
  3 个评论
Godfrey Ojerheghan
Godfrey Ojerheghan 2018-1-11
编辑:Walter Roberson 2018-1-11
Thanks Jan.
Here is the source code as attached:
function [UT1s,MagDataIAGA] = ReadIAGA1s(filename);
UT1s = zeros(1,86400);
MagDataIAGA = zeros(86400,4);
fid = fopen('ILR20071231psec.sec');
if fid > 0
disp(filename)
format = '%4d-%02d-%02d %02d:%02d:%02d.000 %3d %9.2f %9.2f %9.2f %9.2f';
[yyyy,mm,dd,hh,mn,ss,doy,H,D,Z,F] = textread(filename,format,'headerlines',13);
% for j=1:length(yyyy)
% UT1s(1,j) = datenum(yyyy(j),mm(j),dd(j),hh(j),mn(j),ss(j));
% end
UT1s = datenum(yyyy(1),mm(1),dd(1),hh(1),mn(1),ss(1)):1/86400:datenum(yyyy(end),mm(end),dd(end),hh(end),mn(end),ss(end));
MagDataIAGA(1:86400,1) = H;
MagDataIAGA(1:86400,2) = D;
MagDataIAGA(1:86400,3) = Z;
MagDataIAGA(1:86400,4) = F;
else
disp(['Can not find ' filename]);
end
The .mdg file is a MAGDAS (Magnetic Data Acquisition System) file. I saved as a .mat file
Please I do not know how to use the source code to read the .mat file. Please help me out.
Guillaume
Guillaume 2018-1-11
a) Where did you get that code from? The fact that it requires a file ILR20071231psec.sec on the path to be present and never does anything with it (other than leaving it open) is very puzzling
b) that code is not designed to open mat files, only text files in a specific format.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by