MATLAB: Matrix or array composed by zero-values

arrayfindmatrixzero values

Hi, is it present a native matlab command able to verify if a matrix, or an array, given as input is only composed by zero-values? Often i use the find function with the condition matrix == 0 and then i check if the results of find function is equal to the length of the input matrix or array. Thank you!

Best Answer

If M is the matrix or array, do:
all(M(:)==0)