Random data selection from a matrix

 Respuesta aceptada

Image Analyst
Image Analyst el 8 de Mzo. de 2014
Try this:
Z=[43;-57;98;23;-13;243;-98;112;325;560]
elementsToExtract = randperm(numel(Z), 5)
z5 = Z(elementsToExtract)

3 comentarios

Tinkul
Tinkul el 8 de Mzo. de 2014
Sorry sir,i gives error.In the command window it shows the following error:
??? Error using ==> randperm Too many input arguments.
Error in ==> Untitled at 5 elementsToExtract = randperm(numel(Z), 5);
You must have a really old version of MATLAB. What version/release do you have? You can extract the 5 yourself:
Z=[43;-57;98;23;-13;243;-98;112;325;560]
elementsToExtract = randperm(numel(Z))
z5 = Z(elementsToExtract(1:5))
Tinkul
Tinkul el 8 de Mzo. de 2014
Thanx sir. Now its working...I have matlab 7.8.0(R2009a) version...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 8 de Mzo. de 2014

Comentada:

el 8 de Mzo. de 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by