MATLAB: How to play random song from list box in GUI Matlab

matlab gui

How to play randomly the selected song from list song box?

Best Answer

songnames = handles.AppropriateListboxName.String;
N = length(songnames);
randomsong = songnames{randi(N)};
and then proceed to play the song.