1x2 single a.k.a. the cursed variable that refuses to be tamed. How do i turn it into 1x2 double and what is the difference between the two seemingly identical variables?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 “ 1x2 single ”, but my manually made variable that works is referred to as “ 1x2 double ”. Could that be the problem? And in that case how do I convert the cursed variable into 1x2 double format? This is completely new to me and I don’t understand how two identical numbers could be treated differently by matlab..
Thanks.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Feature Detection and Extraction finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!