How can I merge this two commands in one in Matlab?
Temp = diag(diag(A));
X = Temp(:)
Something like
X = diag(diag(A))(:)
does not work.
How can I merge this two commands in one in Matlab?
Temp = diag(diag(A));
X = Temp(:)
Something like
X = diag(diag(A))(:)
does not work.
If you really want to, you can do:
X = reshape(diag(diag(A)),[],1)
I'm not sure you gain much by doing that though!