Cannot plot audio waves in specific axes??
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nirajan Shrestha
am 26 Dez. 2017
Beantwortet: Walter Roberson
am 26 Dez. 2017
Hello, I am trying to plot audio waves in my axes(audioplot) which triggers after a push button - which also plays the audio. However, function that plays the audio lies in a different file from the main file.
----------------------------------------------------------------
function playbutton_ClickedCallback(hObject, eventdata, handles)
global audio_value;
playsounds(audio_value);
----------------------------------------------------------------
This function triggers playsounds.m which has this function. The argument passed is the file path that needs to read.
-------------------------
function playsounds(a)
[y, fs]=audioread(a);
sound(y, fs);
axes(handles.audioplot);
plot(y);
end
-----------------------
Now, I can play the audio file but it does not plot the waves. This is the error that is shown..
Undefined variable "handles" or class "handles.audioplot".
Error in playsounds (line 7) axes(handles.audioplot);
I have googled around and known that the handle is out of scope but I can't really find out what is happening here as the function is being called from the mainfile. It would be a great help if anyone can explain me this. Thanks in advance.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 26 Dez. 2017
In the place you call playsounds add handles as a second argument. In the place you define playsounds add handles as the second argument
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!