How to find the current address coordinates
7 views (last 30 days)
Show older comments
Hello, in my code i have to check adress of the image in GUI every single loop. If the YData coordiantes are equal to -75, the program should change it to 900. Matlab writes this error: "Error using matlab.graphics.primitive.Image/horzcat. Conversion to matlab.graphics.primitive.Image from logical is not possible."
explanation: DU = array of 4 elements, 4 same images, which has to be moved by Y axis from value 900 to -75. After one of the images reach value -75, it moves back to 900
I'm not sure if this whole code is alright. So if somebody have some advice how to improve it I would be grateful. Here is the part of my code.
for pom1 = 1:1:num_of_cars(4)
set(DU(pom1),'YData',Ymax-1.95);
if [DU(pom1),'YData' == -75]
set(DU(pom1),'YData',Ymax);
num_of_cars(4) = num_of_cars(4) -1;
end
end
2 Comments
Sriram Tadavarty
on 20 Mar 2020
The way you used the condition in the if statement seems to be wrong. First access the YData of DU(pom1), assign it a variable and then compare with the value of -75, to make it simple
Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!