Clear Filters
Clear Filters

Resampling scaling truncating Matlab data file

4 views (last 30 days)
I need to perform the conditions to the data file below on the matlab. can you help me how to do that.
Data File = 2x460800
Conditions:
1.) The scaling defined in the PhysioNet .info files for each PhysioNet data file was applied to each raw data file.
2.) The data were resampled to a common rate of 128 hertz.
3.) Each data file consisting of two ECG recordings was separated into two separate data records.
4.) The data length was truncated to a common length of 65536 samples.

Answers (1)

Karan Singh
Karan Singh on 3 Oct 2023
Hi Hakan,
I understand that you need help with performing the conditions on the data file in MATLAB. Here's a guide on how to accomplish each condition:
  • Scaling the data: If you have the scaling factor provided in the .info file, you can multiply each data point by the scaling factor to apply the scaling eg.
scaled_data = raw_data * scale.
  • Resampling the data to 128 Hz: MATLAB provides the resample function to resample the data. Assuming your original data is stored in the variable raw_data and the original sampling rate is original_fs, you can use the following code to resample the data to 128 Hz:
desired_fs = 128; % Desired sampling rate
resampled_data = resample(raw_data, desired_fs, original_fs);
  • Separating the data into two separate data records: Assuming the concatenated data is stored in the variable concatenated_data, you can use the following code to separate them:
data_record1 = concatenated_data(1:end/2);
data_record2 = concatenated_data(end/2+1:end);
  • Truncating the data length to 65536 samples: Assuming your data record is stored in the variable data_record, you can use the following code to truncate it:
truncated_data = data_record(1:65536);
Attached below are some documentation links that you may find helpful:
Hope this helps!
Karan Singh Khati

Community Treasure Hunt

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

Start Hunting!