Clear Filters
Clear Filters

how to call Calling an audio file into an if function!

3 views (last 30 days)
function ProximityFunction (f)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
if 10000 < f && f < 12000
warningMessage = sprintf('Warning: your altitude = %f\nYou may crash!', f);
uiwait(warndlg('Increase Altitude'));
elseif 5000<f && f <10000;
warningMessage = sprintf('Warning: your altitude = %f\nYou may crash!', f);
uiwait(warndlg('Too close to terrain'));
elseif f <5000
warningMessage = sprintf('Warning: your altitude = %f\nYou may crash!', f);
uiwait(warndlg('PULL UP PULL UP'));
end
end
I want to add an audio file which i have already uploaded into matlab. would i be able to use play(player)to play the audio. I want 'play(player') to be after the warning message has been displayed and I am planning to add audio to the other warning messages. how can i get around this

Answers (0)

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!