MATLAB Answers

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

8 views (last 30 days)
Muhammad Asif on 21 Jul 2021
Commented: Bjorn Gustavsson on 27 Jul 2021
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?
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

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
##### 2 CommentsShowHide 1 older comment
Bjorn Gustavsson on 27 Jul 2021
Good, happy that it helped.

Sign in to comment.

R2020a

### Community Treasure Hunt

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

Start Hunting!