problem with loading data
Mostra commenti meno recenti
Hi!
I've got a problem with loading data (.dat files) to Matlab. I've got a file with data from rheography and ecg, but it's got specific format:
- first 4 Byte: 00 serial number X Zo
- 4092 Byte: data from calibration rheo and ecg (i need to load every fourth Byte, because I only need the ecg data)
- 4 Byte: 00 serial number X Zo
- 4092 Byte: every second Byte is ecg which is what i need to load
I've been trying to load it but all I've got is this:
"??? Error using ==> load
Number of columns on line 1 of ASCII file
C:\Users\Owu\Documents\MATLAB\program\Arek.dat
must be the same as previous lines."
Could anybody help me to find the solution how to separate ecg data from the file? I need to load it into my programe.
I'll be very geateful for your help.
1 Commento
Jan
il 20 Nov 2011
@Olga: The format of the file is not clear. Please edit your question. I assume, you have to insert an empty line before the list.
Risposta accettata
Più risposte (1)
Olga
il 20 Nov 2011
0 voti
4 Commenti
Jan
il 20 Nov 2011
It would be better to insert these clarifications in the original question and not as an answer.
Did my FREAD advice help you?
Image Analyst
il 20 Nov 2011
Olga, Jan's code should do it for you. I do basically the same thing wen I read in raw data files. Then, to pluck out every 4th point from the 4092 array you'd do something like
ecgData = Data(startingIndex:4:end);
The startingIndex would be whatever it is for the ecg data, which would be 1, 2, 3, or 4. The 4 means to take every 4th one. "end" means the last element of the array, 4092 in this case.
Image Analyst
il 20 Nov 2011
By the way, is it every 4th byte like you said first, or is it every 2nd byte like you just said now? Either way, you change the middle value in startingIndex:4:end to be either 2 or 4 once you figure out which way it really is. By the way, are you sure the binary data is 8 bit byte data and not floating point single or double precision data? Because if it is, there would be a different args to fread().
Olga
il 20 Nov 2011
Categorie
Scopri di più su Large Files and Big Data in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!