필터 지우기
필터 지우기

avoiding same data in looping

조회 수: 1 (최근 30일)
Muammar
Muammar 2011년 11월 26일
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

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 11월 26일
For A=1:3
fprintf('The value of A is: %d\n',A);
end
  댓글 수: 3
Fangjun Jiang
Fangjun Jiang 2011년 11월 26일
For that, you can use randperm(N), e.g. A=randperm(3)
Muammar
Muammar 2011년 11월 27일
Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Performance and Memory에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by