Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to pick a percentage of data matlab
    primarykey
    data
    text
    <p>Hi I have a data set lets call it <code>dataset A</code> and this dataset consists of 500x10 samples. I have another <code>dataset B</code> which is the class labels for each of those rows.</p> <pre><code>Dataset A | Dataset B 1 0.2 | 0.3 = Green 2 0.1 | 0.1 = Red 3 0.2 | 0.4 = Blue </code></pre> <p>and so on...</p> <p>I want to choose a percentage of blue and red from dataset A lets call it percentOfA and have another dataset which corresponds to that from dataset B, lets call it <code>ResultOfA</code> which is just matching colours to the percent of colours choosen from A. </p> <p>So the new dataset <code>percentOfA</code> would look like:</p> <pre><code>1 0.2 | 0.4 2 0.2 | 0.4 3 0.2 | 0.4 4 0.1 | 0.1 </code></pre> <p>75% blue and 25% red, then the new <code>resultOfA</code> would look like this:</p> <pre><code>1 Blue. 2 Blue. 3 Blue. 4 Red. </code></pre> <p>How is this achieved in matlab? </p> <p>Sorry I would try show code but I cant find anything for this in the documentation. </p> <p><strong>NEW EDIT:</strong></p> <p>So I am a tad lost on how to explain this better. Dataset B contains 500x1 of colours, Blue, Green, Red etc</p> <p>This dataset B matches dataset A but dataset A contains numerical values of what constitutes those colours.</p> <p>All I want to do is use dataset B to pick 75% of the blue colour and the ones it picked it keeps track of the row number and then uses those row numbers to take the data out of dataset A and put it into a new dataset. </p> <p>So that way my "newdataset" will just be 75% of the blue colour and or also 25% red from dataset A (the numerical values). </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload