ERROR using yarpMEX - Yarp MatLab bindings on MATLAB R2020b when mexErrMsgIdAndTxt is invoked
Closed this issue · 6 comments
Hi @traversaro , when I try to go on for checking the bindings installation, as suggested here, when I type yarpVec.fromMatlab([1;2;3])
the following error is returned:
Error using yarpMEX
The error message identifier is invalid.
Error in yarp.Vector/fromMatlab (line 163)
[varargout{1:nargout}] = yarpMEX(2590, self,
varargin{:});
Error in SwigRef/subsref (line 33)
[varargout{1:nargout}] =
builtin('subsref',self,s);
Do you know how to solve this?
I do not know in particular how to approach this problem, it could be due to some change in recent MATLAB R2020b that is not properly supported in SWIG. Anyhow, it seems to be similar to robotology/robotology-superbuild#515 . Perhaps @lnobile could let us know how he worked around this, for example I guess you can set the elements of a YARP vector also with the setVal method?
Hi everybody,
I ended up using bottles to write data on a port, an example:
% writing to port example:
port_points_opti = Port; % create port
port_points_opti.open('points_opti:o'); % open port with desired name
b_points_opti = Bottle(); % create bottle
b_points_opti.clear();
for kk = 1:size(opti_points_matrix,1)
b_points_opti.addDouble(opti_points_mat(kk,1)); % add elements to bottle
end
port_points_opti.write(b_points_opti) % write to port
Apparently, the error for some reason is in https://github.com/robotology/yarp/blob/5313b2defd8be7237567ea56eca8dde93dfc8121/bindings/matlab/vectors_fromTo_matlab.i#L59, in the use of the mexErrMsgIdAndTxt
function. However, that part of the code is reached as, differently from the iDynTree version, the yarp's fromMatlab
already wants to be the YARP vector of the correct size. So, without any further fix, this version of the snippet should work fine:
yarpVec = yarp.Vector();
yarpVec.resize(3);
yarpVec.fromMatlab([1;2;3]);
yarpVec.toMatlab()
cc @giovannipizzolante @lnobile
If you want to test it again, you can check the one line installation procedure in https://github.com/robotology/robotology-superbuild/blob/master/doc/matlab-one-line-install.md .
Fixes for this issue are provided in:
robotology/yarp#2564 was merged, now we just need to re-generate the bindings.
Fixed by #67 and released as https://github.com/robotology/yarp-matlab-bindings/releases/tag/v3.4.4 .