error in opening MIT ecg database
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
anas qazaz
il 28 Gen 2017
Commentato: Walter Roberson
il 28 Gen 2017
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 Commento
Star Strider
il 28 Gen 2017
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
Risposta accettata
Walter Roberson
il 28 Gen 2017
fd = fopen( fullfile(pathname, filename), 'r')
2 Commenti
Walter Roberson
il 28 Gen 2017
[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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Audio and Video Data in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!