필터 지우기
필터 지우기

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