在大多数情况下,我有一个返回单个元素的函数。在特定情况下,它返回一个向量。如何有效地检查给定值是否存在于函数的返回值/值中。?
for i=1:n
x=somefunc(data)
//now x could be single value or vector
//say k single value, k=5.
if(k==x) // This works if x is single value. What to do in case x is vector.?
//do something
end
// k value changes in every loop, so does x.
end