Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: extract the rows except the specific index

$
0
0
On 12/28/2012 12:47 PM, dpb wrote:
...

> b=1; t=6; n=3;
> idx=randperm(t,n); % doc randperm
> train = A(idx,:);
> test=A(setdiff([t:b],idx),:); % doc setdiff and friends...

typo...

test=A(setdiff([1:t],idx),:); % doc setdiff and friends...

Can't really generalize randperm just by t:b; it only takes the one
argument so if that's needed (didn't look like would be from original
post but just for the record) it'll need handling somewhat differently.

--

Viewing all articles
Browse latest Browse all 19628

Trending Articles