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

3 次查看(过去 30 天)
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by