Hi,
I need to extract the main diagonal of a matrix with lower complexity than the "diag" function has. I tried the following simple loop:
for i=1:length(a)
my_diag(i)=a(length(a)*(i-1)+i)
end
Unsurprisingly it works, but it's much slower than "diag".
Any ideas?
Thanks
