MATLAB Answers


index to matrix columns

Asked by laplace laplace on 20 Jun 2013

i want put indices to matrix columns. eg

i got 1 2 3 3 4 5 6 7 8

i want to assign indices to the column vectors [1:3:6] etc

and is there a way to put random indices? the way crossvalind command does? the problem with crossvalind is that it only accepts arrays not column vectors

any ideas?


Log in to comment.

1 Answer

Answer by the cyclist
on 20 Jun 2013

I think you can do what you want using the randsample() command.

doc randsample

for details.


Log in to comment.

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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!