I have two pieces of data. One of them is the actual fulldata , which is a 49625x6 numerical data set, and the other is the index of this data with the target class named Book2 , which is 49625x1.
Book2 has six names (lines) repeating over and over to match the records in the fulldata dataset. I want to take 1000 samples from a fuldate, of which 25% of 1000 samples are “blue” and 75% are “red” using Book2, then they contain this in a new subsample called sampledata .
How can I achieve this in MATLAB?
Pseudocode:
Choose 250 blue samples from Book2, don’t know how to “choose” 250 random “blue” samples bluesample = indX(Book2, :) or Book2(indX, :) not sure.
Select 750 red samples from Book2, again you don’t know how to "select" 750 random "red" samples redsample = indX(Book2, ;) or Book2(indX, :) again are not sure.
Combine the blue and red patterns into a subsample.
subsample = join(bluesample, redsample)
Find the subsample indices and create sampledata from fulldata:
sampledata = subsample(indX(fulldata), :) This line is probably wrong
This is an image of two data sets:

Each line in book 2 corresponds to a line in fulldata. I am trying to achieve the ability to select a certain amount of "normal" and a certain amount of "abnormal" (yes, I know that they are not exactly named) data from fulldata using Book2, since Book2 is a full index and contains class labels.
So, in terms of my dataset, it’s easier to say:
Choose 250 random samples of the string "normal." from Book2 and log the row number. Choose 750 random samples of the string "not normal." from Book2 and log the row number. Combine the two random samples of row numbers together. Make a new dataset (1000x6) using the combined row numbers (above) of fulldata.