필터 지우기
필터 지우기

for loop with non-linear input

조회 수: 2 (최근 30일)
darksideofthemoon101
darksideofthemoon101 2011년 4월 5일
Hi,
I have an array 'layer' that I want to randomise and use in a for loop, in the randomised order.
layer=0.05:0.0025:0.15;
rand_layer = randperm(length(layer));
layer=layer(rand_layer);
I can't use 'layer' as the input for the loop, so is there another way of have the input of the loop in the desired order?
Thanks,
Richard

채택된 답변

Sean de Wolski
Sean de Wolski 2011년 4월 5일
for ii = 1:length(layer)
do_stuff_with(layer(ii));
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by