# MATLAB: 1×2 single a.k.a. the cursed variable that refuses to be tamed. How do i turn it into 1×2 double and what is the difference between the two seemingly identical variables

computer visiondoubleformatjavamatchfeaturesinglevariable

I am trying to programmatically take a screenshot and identify the location of a specific button on the screen using the technique described here: http://www.mathworks.com/help/vision/ref/matchfeatures.html It works like a charm and I end up with the pixel location for the center of the button for example X=[278 93]; Then what I want to do is move the mouse cursor to the pixel location, X, by writing:
import java.awt.Robot;import java.awt.event.*;mouse = Robot;mouse.mouseMove(X(1), X(2));
But Matlab only responds: “mouse.mouseMove(X(1), X(2)); No method 'mouseMove' with matching signature found for class 'java.awt.Robot'.”
And nothing happens. And this is where things get really freaky. Because if I don’t identify the buttons location at all and just type manually: X=[278 93]; and then the same thing:
import java.awt.Robot;import java.awt.event.*;mouse = Robot;mouse.mouseMove(X(1), X(2));
it moves the mouse to the location without complaining!!
And in the first case where the mouse doesn’t move, even if I type A=X(1), B=X(2) followed by: mouse.mouseMove(A, B); it still doesn’t help. To me the variable looks 100% identical to the one that I create manually like this X=[278 93]. It’s like the numbers coming out of my button location have been cursed or something and won’t work even though they seem correct! It’s the strangest thing I have even encountered in Matlab!
• Update : Just now when I’m writing this I noticed by chance that when I hover over the “cursed variable” X, matlab calls is a “ 1×2 single ”, but my manually made variable that works is referred to as “ 1×2 double ”. Could that be the problem? And in that case how do I convert the cursed variable into 1×2 double format? This is completely new to me and I don’t understand how two identical numbers could be treated differently by matlab..
Thanks.

X = double(X);