How to find the current address coordinates
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Sriram Tadavarty
el 20 de Mzo. de 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
Miroslav Jiránek
el 20 de Mzo. de 2020
Editada: Miroslav Jiránek
el 20 de Mzo. de 2020
Respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!