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!