Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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`

What I have tried:

[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')
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900