Clear Filters
Clear Filters

how to insert diganole of zeros in to matrix without using loops ?

1 view (last 30 days)
my question is simple how to change the main diagonel of nXn of random numers and change the main diagonle to zeroes ?
without using loops ?

Accepted Answer

madhan ravi
madhan ravi on 3 Mar 2019
a(logical(eye(size(a,1))))=0 % where a is your matrix

More Answers (0)


Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!