MATLAB Answers

How to Plot Smooth psuedo wigner Ville Distribution of multiple signals and save them each in a folder.

5 views (last 30 days)
Hello Everyone!
I have a total of 89 ECG Signals, for which i have to do time frequency analysis means i have to find the smooth psuedo wigner ville distribution (SPWVD) of all 89 signals. I want to read each signal (one by one), plot their (SPWVD) and save that image into a folder. It means that there are a total of 89 images saved in a folder.
Actually, I am reading each signal, potting their time-frequency transform and then save that image in a folder which is taking too much time. I have also plotted Continous Wavelet Transform (CWT) of these 89 signals for which i uses CWTfilterBank (it loads all signals at once, computes CWT and saves each image to a folder), I cannot find this kind of ease in the former scenario. Can anybody please tell guide me how to find (SPWVD) of all 89 signals (at once or through a loop) and save them in a specific folder?

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 21 Jul 2021
If you can do something like this:
ECG_files = dir('your-data-files.ECG'); % modify to read your data-files...
output_dir = 'WV-plots'; % modify to put this where it fits
mkdir(output_dir)
for iFiles = 1:numel(ECG_files)
curr_ECG = your_read_ECG_fcn(ECG_files(iFiles).name); % modify...
cWV = wvd(curr_ECG); % add additional inputs
your_WV_ecg_plot(cWV)
filename = sprintf('WV-ECG-%02d.png',iFiles);
filename = fullfile(output_dir,filename);
print('-dpng','-painters',filename)
end
Then it should run automatically.
HTH

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by