필터 지우기
필터 지우기

error in opening MIT ecg database

조회 수: 1 (최근 30일)
anas qazaz
anas qazaz 2017년 1월 28일
댓글: Walter Roberson 2017년 1월 28일
hello,
I want read and plot ECG signal downloaded from MIT data base (.dat) i use the following codes:
clear all
clc
close all
[filename, pathname] = uigetfile('*.dat', 'Open file .dat');% only image Bitmap
if isequal(filename, 0) || isequal(pathname, 0)
disp('File input canceled.');
ECG_Data = [];
else
fid=fopen(filename,'r')
end;
time=10;
f=fread(fid)
Orig_Sig=f(1:length(f));
%plot(Orig_Sig(1:2:length(f)))
plot(Orig_Sig(1:2:4000))
i get the following error:
Error using fread Invalid file identifier. Use fopen to generate a valid file identifier.
how i can read these data?
thank in advance
  댓글 수: 1
Star Strider
Star Strider 2017년 1월 28일
If you are using the PhysioBank ATM to access the files, it is much easier to request the MATLAB ‘.mat’ file than the other formats to use them in MATLAB. Then you can just load them. Be sure to download the accompanying ‘.info’ file as well, since it has the sampling frequency and other information you will need to process your signals

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2017년 1월 28일
fd = fopen( fullfile(pathname, filename), 'r')
  댓글 수: 2
anas qazaz
anas qazaz 2017년 1월 28일
thank Mr Walter my data stored in E drive , bin file, the data file name 102.dat how i can use your code?
Walter Roberson
Walter Roberson 2017년 1월 28일
[filename, pathname] = uigetfile('*.dat', 'Open file .dat');
if isequal(filename, 0) || isequal(pathname, 0)
disp('File input canceled.');
ECG_Data = [];
else
fid = fopen( fullfile(pathname, filename), 'r')
time = 10;
f = fread(fid)
Orig_Sig=f(1:length(f));
plot(Orig_Sig(1:2:4000))
end
You are requesting to open a file that is not in your current directory. uigetfile() returns the directory and filename in different outputs -- so it does know which directory you requested but the directory is not built into the filename output. You then tried to open using just the filename output without putting together the information uigetfile() returned about the directory.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by