To separate a set of data into two groups
Show older comments
Assume we have the following array as declared in the following example: x(1)=1 x(2)=2 x(3)=3 x(4)=4 x(5)=5 . up to . . x(100)=100 Assume we have already read this array (i.e stored already in x(i)) how can write a MATLAB code to select 30% of the observation x(i).How can form two groups ,1st containing 30% and 2nd containing 70%
1 Comment
Image Analyst
on 23 Aug 2013
How do you want to select them? Randomly? By taking there value into account somehow? There are several ways that you could use to either select two groups (randomly, by percentiles, etc.) or to classify your data into two groups (e.g. kmeans, SVM, fuzzy c-means, etc.)
Accepted Answer
More Answers (1)
carenar
on 26 Jun 2015
0 votes
I have a similar problem in that I am trying to split my data into two parts (ie at the max y value and its corresponding x value). how would I do so?
1 Comment
Walter Roberson
on 26 Jun 2015
[maxy, maxyidx] = max(y);
x1 = x(1:maxyidx);
x2 = x(maxyidx+1:end);
y1 = y(1:maxyidx);
y2 = y(maxyidx+1:end);
You were not specific about whether the maximum itself should go into the first set or the second set.
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!