MATLAB: Concatenate two audio files

audio

I would like to concatenate two audio files such that a new audio signal is created whereby the first audio plays and this is then immedialely followed by the second.
[y1,Fs] = audioread('sample1.wav');
y1_sample_rate = 8000;
[y2,Fs] = audioread('sample2.wav');
y3 = [y1(1:y1_sample_rate,:); y2;];
What am I doing wrong?
Thank you.

Best Answer

If your intentions are to subsample every 8000 values in y1 and then concatenate y2 to the end,
y3 = [y1(1:y1_sample_rate:numel(y1)); y2];
% |________| ^ no need for semicolon