MATLAB: Find all non zero values in an array AND display the values

findMATLAB

Hi,
I have a matrix of 1×1177 and I wanted to display all the nonzero values with the array and the location of them.
I am able to get the location of them using:
find(matrixOne)
But I also need the values to be displayed.
Is there a way of doing this without me having to look through the array manually?
Many thanks

Best Answer

x = randi([0 4],1,1177)
[row,col,value]=find(x)