how to loop it that if same continuos signal is coming like left and vice versa then it playes only once.

switch (e)
case 5
[a fs]=wavread('tl.wav');
playerl=audioplayer(a,fs);
play(playerl),disp('left'),fprintf(ser,'L');
case 6
[a fs]=wavread('tl.wav');
playerl=audioplayer(a,fs);
play(playerl),disp('left'),fprintf(ser,'L');
case 7
[a fs]=wavread('tl.wav');
playerl=audioplayer(a,fs);
play(playerl),disp('left'),fprintf(ser,'L');
case 9
[b fs]=wavread('tr.wav');
playerr=audioplayer(b,fs);
play(playerr),disp('right'),fprintf(ser,'R');
case 10
[b fs]=wavread('tr.wav');
playerr=audioplayer(b,fs);
play(playerr),disp('right'),fprintf(ser,'R');
case 11
[b fs]=wavread('tr.wav');
playerr=audioplayer(b,fs);
play(playerr),disp('right'),fprintf(ser,'R');
case 13
[c fs]=wavread('mf.wav');
playerf=audioplayer(c,fs);
play(playerf),disp('forward'),fprintf(ser,'F');
case 14
[d fs]=wavread('mb.wav');
playerb=audioplayer(d,fs);
play(playerb),disp('back'),fprintf(ser,'B');
case 15
[c fs]=wavread('mf.wav');
playerf=audioplayer(c,fs);
play(playerf),disp('forward'),fprintf(ser,'F');
otherwise
[e fs]=wavread('s.wav');
players=audioplayer(e,fs);
play(players),disp('stop'),fprintf(ser,'S');
end

1 Comment

Please format the above code so that it is readable. Highlight the code and press the {} Code button.
Also, please describe in more detail what problem you are facing as it isn't that clear from your question. Clarify what you mean by how to loop it that if same continuos signal is coming like left and vice versa then it playes only once.

Answers (0)

This question is closed.

Tags

Asked:

on 22 Oct 2014

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!