Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Select and sort some random columns and sort the remain columns

Subject: Select and sort some random columns and sort the remain columns

From: MOOON MOOON

Date: 19 Nov, 2011 08:33:13

Message: 1 of 2


Hello,

I have a matrix m by n and I want to use it in some

Neural Networks applications.

For example,

A = [ 24 22 35 40 30 ; 32 42 47 45 39 ; 14 1 10 5 9 ; 2 8 4 1 8] ;

I want to train randomly some columns and test the other remaining columns.

For example, I want to train randomly 3 of the total columns length

and test the other remaining columns. So, the first matrix will contain three random

distinct columns taken from the original matrix A, while the second matrix contains

the remaining two columns.

How can I extract these data ?


Thanks

Subject: Select and sort some random columns and sort the remain columns

From: Roger Stafford

Date: 19 Nov, 2011 19:13:11

Message: 2 of 2

"MOOON MOOON" wrote in message <ja7pk9$6pk$1@newscl01ah.mathworks.com>...
> Hello,
> I have a matrix m by n and I want to use it in some
> Neural Networks applications.
> For example,
>
> A = [ 24 22 35 40 30 ; 32 42 47 45 39 ; 14 1 10 5 9 ; 2 8 4 1 8] ;
>
> I want to train randomly some columns and test the other remaining columns.
> For example, I want to train randomly 3 of the total columns length
> and test the other remaining columns. So, the first matrix will contain three random
> distinct columns taken from the original matrix A, while the second matrix contains
> the remaining two columns.
> How can I extract these data ?
> Thanks
- - - - - - - - -
 t = 3; % Number to be trained
 n = size(A,2);
 p = randperm(n);
 B1 = A(:,sort(p(1:t))); % Train set
 B2 = A(:,sort(p(t+1:n))); % Test set

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us