Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Is there a way to test if a variable is a matrix in Prime 2.0?
I'm writting a function that uses the function vertflip. I want my function to accept a scaler or matrix, but vertflip only accepts matricies. So I'm looking to do something like...
vertflip(if(ismatrix(M), M, [M]))
Solved! Go to Solution.
Got it. The "rows" function accepts a scalar or matrix and returns a zero if given a scalar. I just have to check if rows(x) = zero, and then return the function without the reverse operation.
Can you use "reverse" and do it for all columns?
I was unaware of "reverse" but it won't accept a scalar either.
Ooo. Reverse accepts units. Much better than vertflip for my purposes. Thanks.
Got it. The "rows" function accepts a scalar or matrix and returns a zero if given a scalar. I just have to check if rows(x) = zero, and then return the function without the reverse operation.