I am working on a 7 DOF serial manipulator and was trying to use ikine to get the joint coordinates for simple 2 DOF robot.

Even though I am using the masking vector as [ 1 1 0 0 0 0 ], I am getting error stating:

Number of robot DOF must be >= the same number of 1s in the mask matrix

This is my 2 DOF robot

L1 = Link('d', 0, 'a', 1, 'alpha', 0);




q0=r2.ikine([eye(3),[0.2;0;0];[0,0,0,1]],[0,0],[1 1 0 0 0 0]);

Can anyone please help and explain why is it happening?


2 Answers 2


What are the options you're passing to the r2.ikine function? I believe that, at a minimum, you need to identify them. Try something like the following:

q0 = r2.ikine([eye(3),[0.2;0;0];[0,0,0,1]],'mask',[1 1 0 0 0 0]);

I can't tell what your [0,0] is (and neither can the function!), so I don't know what to suggest for that.

  • $\begingroup$ Thank you !! I just started learning this toolbox , Can you please explain why you haven't estimated any initial estimate for joint coordinate ?? i think by default its 0,0 ? $\endgroup$ Commented Jun 22, 2017 at 1:02
  • $\begingroup$ @JasmeetSingh - I can't comment as to whether or not you need an initial estimate, I was just pointing out that, when you use multiple input-value arguments, you need to state what the input is. $\endgroup$
    – Chuck
    Commented Jun 22, 2017 at 12:58
  • $\begingroup$ Bit harsh. It's alive and well on GitHub. Perhaps for "official" you mean MathWorks authored. Third party toolboxes are a core part of what makes MATLAB such a productive tool. $\endgroup$ Commented Jul 23, 2019 at 15:01
  • $\begingroup$ @PeterCorke - Sorry, wasn't trying to be harsh. I'm genuinely super honored and tickled that you're here and actively contributing on the site. I think that, at the time, we were getting actually quite a lot of questions about the Robotics Toolbox and I remember thinking that a lot of them felt like broken functionality. There were some big Matlab updates happening at the time (execution engine, graphics engine, etc.) and it wasn't clear to me if the problems were user error or compatibility issues with the updating versions of Matlab. $\endgroup$
    – Chuck
    Commented Jul 23, 2019 at 16:44
  • $\begingroup$ I've edited my comment now; please accept my apologies. I'm afraid there may be some other comments of mine where I wasn't intending to disparage the Robotics Toolbox, but to try to alert users that the Mathworks-authored Robotics System Toolbox was officially supported. In fairness to me, there weren't (and still aren't) any links to the GitHub repo from your site and the site was pretty outdated at the time. If I come across any other similar comments I'll withdraw them as well. $\endgroup$
    – Chuck
    Commented Jul 23, 2019 at 16:48

It depends on which version of the Robotics Toolbox you're using, but for RTB10 you need to use the 'mask' keyword before the mask.

You'll get much faster response to questions if you post them to the RTB support forum. It's almost impossible to find all RTB related questions in Stack Exchange.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.