forming a function handles in matrix
    조회 수: 8 (최근 30일)
  
       이전 댓글 표시
    
I want to form a set of function handles in a row matrix.
i wrote script like below.
w = 2;
Nr = 20
nr = @(phi)zeros(1, Nr);
wr = @(phi)zeros(1, Nr);
  for n = 1:Nr
        for i = 1:w
            Awr = 50*(cos(i*2)-cos(i*9));
            nr(1, n) = @(phi)nr(1, n)+Awr*cos(i*1.7);
        end
      wr(1, n) = @(phi)nr(1, n)
   end
Iam getting the below error
Nonscalar arrays of function handles are not allowed; use cell arrays instead.
how to rectify this??
댓글 수: 0
답변 (1개)
  Steven Lord
    
      
 2021년 10월 4일
        MATLAB used to allow nonscalar arrays of function handles, but that functionality was removed probably 10 to 15 years ago. As the error message suggested, store your function handles in a cell array instead.
댓글 수: 7
참고 항목
카테고리
				Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


