Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: extract the rows except the specific index
Replies: 3   Last Post: Dec 28, 2012 4:19 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
uny gg

Posts: 45
Registered: 8/4/09
extract the rows except the specific index
Posted: Dec 28, 2012 12:56 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello, I am newbie.. for matlab..

I would like to extract the rows except the specific index..

For example,

A = (1,2,3;4,5,6;7,8,9;10,11,12;13,14,15;16,17,18) % 6 by 3 matrix.

What I want to do is..
divide this matrix, 3 by 3 and 3 by 3 matrix randomly ...
Here is what I try.

bottom =1;
top =6;

ran_idx = bottom + (top - bottom)*rand([1,3]);
ran_idx = ceil(ran_idx);

train = A(ran_idx,:);
test = A(~ran_idx.:); % this one is not working,, return. empty matrix..

I can extract the train matrix.. but I could not make test..

Could you please somebody answer thie one?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.