The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Random Selection of Non-consecutive numbers
Replies: 1   Last Post: Nov 6, 2013 5:19 PM

Advanced Search

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

Posts: 2,359
Registered: 12/6/04
Re: Random Selection of Non-consecutive numbers
Posted: Nov 6, 2013 5:19 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"nayyer " <> wrote in message <l5ecq1$mnt$>...
> Hi,
> suppose i have a matrix of 3*2500 dimension. In the 3rd row i have the values which are not consecutive and have no order. I want to select randomly 4 values each time from 3rd row. remember that values are not consecutive.
> Thanks

% One method would be to use RANDPERM

doc randpem

% something like:
m = rand(3,2500);
% (for each time)
n = randperm(2500);
values_4 = n(1:4);
% I don't have MATLAB installed on this computer.
% So, I'm not exactly sure about the syntax of the last statement.
% But it should be close.

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.