Select signals from the table on the left to view them in the Simulation Data Inspector. By default, the legend is located outside of the subplot at the top-left.
Use the Simulink.sdi.setLegendPosition function to move the legend inside the subplot and to the right.
Simulink.sdi.setLegendPosition("InsideRight")
You can confirm the location of the legend programmatically using the Simulink.sdi.getLegendPosition function.
Simulink.sdi.getLegendPosition
ans =
'InsideRight'
You can also use the Simulink.sdi.setLegendPosition function to remove the legend.
Legend position in the Simulation Data Inspector, returned as one of these values:
"OutsideTop" — Outside the subplot area on the
top-left
"OutsideRight" — Outside the subplot area on the
top-right
"InsideTop" — Inside the subplot area on the
top-left
"InsideRight" — Inside the subplot area on the
top-right
"None" — No legend
When the legend position is "OutsideTop" or
"InsideTop", the software lists legend entries horizontally. When
the legend position is "OutsideRight" or
"InsideRight", the software lists legend entries vertically.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.