To write a function in MATLAB that performs the above calculation, you can do the following:
main.m251 chars9 lines
Explanation:
matrix_dimensions
that takes an input matrix as an argumentsize
function to get the dimensions of the input matrixm
and n
are equal, which means the matrix is square. In that case, we throw an error.output
with the dimensions m
and n
.You can call this function with any non-square matrix to get its dimensions.
gistlibby LogSnag