How can I split a data set in training and test data set after creating a data set named
first_data (contains 3000 samples)
in MATLAB?
I want to split $2000$ samples as training and $1000$ samples as test data set.
I am new to MATLAB- thanks in advance.
Well, put your data in a matrix and take the first 2000 data and train your model on it(I am assuming this is a supervised learning). Then you can test your model on the 1000 data and compute your error. This would be in matlab(if your data is row vector).
Alternative approach would be to split the data into k-sections and train on the K-1 dataset and test on the what you have left. Doing this repeatedly is helpfully to avoid over-fitting. For much detail read about bias-variance dilemma and cross-validation.