Just because MATLAB passes a large array into a function doesn't mean it needs to make a copy of that array if you don't modify the input in the function
S = repmat(dir, 1000, 1000);
It took much less time to perform the operation in myfun than it did to create S, and if myfun were copying S you'd expect that time to be closer to the creation time. As a different example using a numeric array rather than a struct:
There's a limit to how big I can make A in a MATLAB Answers post, but try the code yourself in a desktop installation of MATLAB with a larger A if you want to see a larger difference in the times.