With the change to @sdpvar/n, it seemed to run correctly with several solvers using YALMIP R20141218 (with not surprisingly, different valid solutions depending on the solver), but produces a vector of ones using R20150204. But as you say, perhaps that code is still buggy.
But my bigger discovery was an apparent bug in the interface to baron when there is no objective function or a fake objective function such as 0 which has no sdpvar.
Here is the simplest example of that bug:
sdpvar x;optimize(x>=0,[],sdpsettings('solver','baron','debug',1))
which produces
Error using callbaron (line 23)
Error: Expression or statement is incomplete or incorrect.
Error in solvesdp (line 329)
eval(['output = ' solver.call '(interfacedata);']);
Error in optimize (line 31)
varargout{:} = solvesdp(varargin{:});
Use of 0 instead of [] for the objective gives the same error.
sdpvar x;optimize(x>=0,x,sdpsettings('solver','baron','debug',1))
executes correctly
I am using matbar version 1.69.