How can I insert a uifigure in my livescript code?

Hi guys, I d' like to insert a uifigure in my livescript as in the following image:
The problem is that when I run the code, the uifigure appears in a separate window but I want it inside a box within my livescript.
The image is taken by an example livescript that is given by the mapping toolbox:
Can you help me, pleae

6 comentarios

Adam Danz
Adam Danz el 11 de Jun. de 2021
I don't think you can embed a figure produced by uifigure in a live script. Unless that has been changed recently, you'll have to use a figure produced by figure().
Giuseppe
Giuseppe el 11 de Jun. de 2021
Thanks @Adam Danz. But this operation is performed in the livescript in the attached link. So, I guess it is possibile.
Adam Danz
Adam Danz el 11 de Jun. de 2021
Editada: Adam Danz el 11 de Jun. de 2021
Take a second look and notice the following 2 observations.
  1. When you run the live script, what happens?
  2. The figures that follow sections of code that use uifigure are actually images (screen shots of the figure), not embedded figures produced by the live script. You can hit the "clear all output" button to clear all internally produced figures and you'll see that the ones following blocks of code that use uifigure remain.
Giuseppe
Giuseppe el 12 de Jun. de 2021
1. In the example livescript the embedded figure is a GIF, but when I run the code it appears also in a separated window. 2. As I've said above, the uifigure is not an image but a GIF.
And the separated figure can be uifigure(), but you cannot get one in line with Live script.
Adam Danz
Adam Danz el 12 de Jun. de 2021
GIFs are image files but I could have been clearer. If you look at other figures in that demo created by uifigure, they are all inserted as images (example below).
The creators of that demo could have been clearer that they were inserting images.

Iniciar sesión para comentar.

 Respuesta aceptada

Adam Danz
Adam Danz el 11 de Jun. de 2021
Editada: Adam Danz el 11 de Jun. de 2021
Embedded figures in the Live Editor should be created with the figure() function instead of the uifigure() function.
If, for some reason a uifigure is required or you'd like to embed an existing uifigure, you can copy its content to a regular figure using the example below.
% In Live Editor (r20201a)
fig = uifigure('Visible','off'); % Produced externally, but invisible.
ax = axes(fig);
plot(ax, rand(5))
f2 = figure; % Produced internally
set(fig.Children,'Parent',f2)
delete(fig)
This won't not work for graphics objects that require the use of uifigure.

Más respuestas (1)

Giuseppe
Giuseppe el 12 de Jun. de 2021

0 votos

Mystery solved!
In the example livescript, the images and GIF are inserted as external files!
However, thanks to everyone for your support.

Categorías

Más información sobre MATLAB Support Package for IP Cameras en Centro de ayuda y File Exchange.

Productos

Versión

R2021a

Preguntada:

el 11 de Jun. de 2021

Comentada:

el 12 de Jun. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by