alternative form for find(max(x))
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
Hi all!
I am trying to optimize my program by reducing the nested coding and perhaps "slow" functions such as find().
I have this:
gamma = 0.5
nodes = 5
if rand >= gamma
        a = find(A(s(1),s(2),:) == max(A(s(1),s(2),:)),1);
    else
        a = randi(nodes);
    end
A is a n x m x o matrix. 
I was wondering if there's a different way to tackle this. I've looked at accum() but I don't seem to make it work properly. Thank you in advance!
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


