How to write a conditional statement for tridiagonal matrix.
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi! I have tridiagonal matrix function where I need to have a conditional statement if a, b, and c contain any nonzero values. If they contain a 0 then I must write an error the the program as the diagonals have to be nonzero values. Attached are the main program with comments and the function program
댓글 수: 0
채택된 답변
Matt J
2021년 4월 1일
편집: Matt J
2021년 4월 1일
a = [3 4 0 8];
validateattributes(a,"numeric", "nonzero")
댓글 수: 2
Matt J
2021년 4월 1일
You don't need to. As you can see from the output above, it does the whole task of checking whether a has the right properties from start to finish, including generating the error message.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!