Avoid reading diagonal and redundant symmetric elements

2 vues (au cours des 30 derniers jours)
Mo H
Mo H le 26 Mar 2020
Commenté : Mo H le 29 Mar 2020
Hello,
I would like to create a matlab function that reads matrix elements and print only those elements which are non diagonal and redundant.
For example,
A = [
1 2 3
2 5 6
3 6 7]
The function should only print; 2, 3, 6
Thank you a lot

Réponse acceptée

Peng Li
Peng Li le 26 Mar 2020
use tril or triu function to get the lower or upper triangular matrix. Or use diag to get nonmain diagonal elements.

Plus de réponses (0)

Catégories

En savoir plus sur Operating on Diagonal Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by