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

2 Ansichten (letzte 30 Tage)
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 Kommentare
Godfrey Ojerheghan
Godfrey Ojerheghan am 11 Jan. 2018
Bearbeitet: Walter Roberson am 11 Jan. 2018
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 am 11 Jan. 2018
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by