Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8849029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:32:42+00:00 2026-06-14T12:32:42+00:00

Below is an example of choosing a set number of random permutations from a

  • 0

Below is an example of choosing a set number of random permutations from a dataset, how can I create a new dataset with the remaainder. For example below I choose 49402 (roughly 10%) and create a dataset named UnseenTestdata after this is chosen I want the remainder to go into a new dataset called testdata.

pointsToPick = 49402;  %# Numbers to pick
rVec = randperm(494021);   %# Random permutation of datapoint indices (N=494021 in this case)  

UnseenTestdata = fulldata(rVec(1:pointsToPick),:); %# Random sample

Unseentestdata minus fulldata = remainder of the dataset aptly named testdata.

Dimensions of fulldata set is 494021×6 of which I choose at random 49402×6 from fulldata. I then need to get whats left from fulldata minus the unseentestdata.

Barnabas Szabolcs added a test case answer of:

fulldata = [1 2; 3 4; 5 6; 7 8];
rVec = randperm(4);  
pointsToPick=2;
unseen = fulldata(rVec(1:pointsToPick),:); 
testdata = fulldata(rVec(pointsToPick:length(rVec)),:); 

However this does not work, I have screen dumped the results:

enter image description here

If you notice in the screen dump unseen data = 3,4 and 7,8 however if you notice in testdata 7,8 remain.

If fulldata =

1,2
3,4
5,6
7,8

And we choose two random rows in this case the rows in unseen are:

row
3,4
7,8

Then whatever remains should be:

1,2
5,6

However if you notice in the sreen dump from the example test testdata has the row:

7,8

showing that the example test does not work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:32:44+00:00Added an answer on June 14, 2026 at 12:32 pm

    If I understand your question correctly, the solution is

    testdata = fulldata(rVec((pointsToPick+1):length(rVec)),:);
    

    Simple test case:

    fulldata = [1 2; 3 4; 5 6; 7 8;10 9];
    rVec = randperm(4);  // gives me first time [4 2 3 1 5]
    pointsToPick=2;
    unseen = fulldata(rVec(1:pointsToPick),:); // [7 8; 3 4]
    // length(rVec) is 5
    testdata = fulldata(rVec((pointsToPick+1):length(rVec)),:); // [5 6; 1 2; 10 9]
    

    you can clearly see that in a sense fulldata = unseen (setplus) testdata.
    Note that we need “+1” because arrays are indexed from one up unlike say in c++, so the last index is length not length-1.

    You can verify if things are correct using this:

     isequal(sort([unseen; test]), sort(full_data)) // should be true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I get only unique departments from the below example? Dept Id Created
With below example code: String column_names[]= {Serial Number,Medicine Name,Dose,Frequency}; table_model=new DefaultTableModel(column_names,3); table=new JTable(table_model); We
The example below is from a REST database driver on Python 2.7. In the
I'm viewing the below example in Chrome and can't seem to get cursor: pointer
I am using the below example code and have a problem where I can't
Consider below example: random_tile = random.choice(tiles) del random_tile It first assigns a random element
In the below example, how can I easily convert eventScores to List<int> so that
The below example is got from Jon Skeet's article, Parameter passing in C# .
In the below example, I want to create a CSS rule that applies only
i am trying the below example to send mail using ssl picked from here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.