lambda function with if statement
이전 댓글 표시
How do I make the following function work for X. I want to be able to write lambda functions with an if clause.
X = @(om) (if abs(om)<1; 1; else 0; end)
답변 (3개)
Erivelton Gualter
2019년 5월 6일
2 개 추천
You can use the following line of code:
X = @(om) (1*(abs(om)==1) + 0*(abs(om)~=1));
NIMMALA HARATHI
2020년 5월 23일
0 개 추천
[X, lambda] = eig(A)
saideh zare
2021년 7월 4일
0 개 추천
Unrecognized function or variable 'lambda'.
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!