avoiding same data in looping

Hii... I am a very new MATLAB user, I want to ask how to avoid same data when I do random looping, Example, I have A = [ x y z], I want to do looping, but every value does not have same value, ex: if I have data from 1 to 3, if x=1, y and z should not be 1 (should be 2 or 3). How to make the m-file?
Thank You

 Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 26 de Nov. de 2011

0 votos

For A=1:3
fprintf('The value of A is: %d\n',A);
end

3 comentarios

Muammar
Muammar el 26 de Nov. de 2011
Thank you.. how if A = [1 3 2] or A = [2 1 3], like randomly chosen data, actually I want to do cross-validation? thank you..
Fangjun Jiang
Fangjun Jiang el 26 de Nov. de 2011
For that, you can use randperm(N), e.g. A=randperm(3)
Muammar
Muammar el 27 de Nov. de 2011
Thank you

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 26 de Nov. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by