How can I let Matlab automatically input the file itself rather than one by one myself?
I mean, I want to put `Sample 1.wav` and then output `Sample 1.png` and then
put `Sample 2.wav` and then output `Sample 2.png` and then put `Sample 3.wav` and then output `Sample 3.png`
I do not want to type myself 1, 2, 3 and rather let the matlab run itself from `1 to 1,000`
[y,Fs] = audioread('sample1.wav'); spectrogram(y,'yaxis') saveas(gcf,'sample1.png')
Then
[y,Fs] = audioread('sample2.wav'); spectrogram(y,'yaxis') saveas(gcf,'sample2.png')
Then
[y,Fs] = audioread('sample3.wav'); spectrogram(y,'yaxis') saveas(gcf,'sample3.png')
Best Answer