Operands to the || and && operators must be convertible to logical scalar values.
    조회 수: 2 (최근 30일)
  
       이전 댓글 표시
    
cl=input('Enter class ( up-1 or down-2 or blink-3): ');
if cl==1
    [k,~]=find((all_peak(:,2)>0)&&((all_peak(:,2)<p1_peak(:,2))))
% %     [k,~]=find(all_peak(:,2)<0);
    ch_n='up';
elseif cl==2
    [k,~]=find(all_peak(:,2)<0);
% %     [k,~]=find((all_peak(:,2)>0)&&((all_peak(:,2)<allnew_peak(;,2)));
    ch_n='down';
else
     [k,~]=find(all_peak(:,2)>0);
    ch_n='blink';
end
  where all_peak =[16,2] matrix , p1_peak =[12,2 ] matrix , allnew_peak=[12,2] matrix. i am getting  error.  Operands to the || and && operators must be convertible to logical scalar values.  how to solve it ?
댓글 수: 3
  Walter Roberson
      
      
 2019년 10월 13일
				Okay, so when you get to all_peak(13,2) then what should it be compared to in p1_peak ?
답변 (1개)
  Fabio Freschi
      
 2019년 10월 13일
        If you work with arrays, use the single & and not &&
댓글 수: 2
  Fabio Freschi
      
 2019년 10월 13일
				
      편집: Fabio Freschi
      
 2019년 10월 13일
  
			So you are comparing arrays of different dimensions. Look at Walter’s comment
참고 항목
카테고리
				Help Center 및 File Exchange에서 Analysis에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


