How to write a conditional statement for tridiagonal matrix.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Matt J
il 1 Apr 2021
Modificato: Matt J
il 1 Apr 2021
a = [3 4 0 8];
validateattributes(a,"numeric", "nonzero")
2 Commenti
Matt J
il 1 Apr 2021
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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!