MATLAB: Function ‘subsindex’ is not defined for values of class ‘audioplayer’

audioaudioplayer

I am new to matlab and learning. while i was trying to play a wav file then this error occured
Function 'subsindex' is not defined for values of class 'audioplayer'
[y, Fs] = audioread(fullfile(play.folder,play.name));%the file path is correct
player = audioplayer(y, Fs);
% player.playblocking(); works while using this
%dosent work while using-
play(player);

Best Answer

You have a variable named play:
play.folder
play.name
If you have an object named play then you cannot (easily) use the play function. Rename that variable and clear the old one from your workspace. Then try it again.