MATLAB: Hump-day puzzler – Unknown Function

puzzler

My colleague was working with MATLAB and defined an anonymous function F. When he saw me come in he typed clc, hit return than challenged me to guess the form of the function only by calling it however many times I want. After calling it many times, I have figured out that it takes a scalar argument, and when the value of the argument is greater than 0 it does this:
>> F(1)
Name Size Bytes Class Attributes
---- 0;']) ------------------------------------------
x 1x1 8 double
And when the value of the argument is less than zero, it appears to do nothing:
>> F(-1)
>>
Can you help me figure out what the function looks like?

Best Answer

I get the sense that this is not exactly what the user did, but this seems to do what is expected as a first try:
F=@(x) eval('if isscalar(x)&&x>0, whos x, end')
===========================
Second iterate: I needed to add in a check for type double. It also prints out the funky characters with WHOS (but without any functionality). :oP
F=@(x) eval(['if isscalar(x)&&isa(x,''double'')&&x>0, whos x, end; 1>0;'])