error in opening MIT ecg database
1 回表示 (過去 30 日間)
古いコメントを表示
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
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
2017 年 1 月 28 日
fd = fopen( fullfile(pathname, filename), 'r')
2 件のコメント
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 Center および File Exchange で Audio and Video Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!