https://technicalsource9.medium.com/i-need-to-isolate-certain-values-of-a-matrix-based-on-whether-71ddd6ef38f9