What's the alternative of DisplayName in App Designer?

4 Ansichten (letzte 30 Tage)
Davide Verga
Davide Verga am 16 Jun. 2021
Kommentiert: Davide Verga am 17 Jun. 2021
In the old GUIDE, I was using this code in a for loop, in order to label my plot:
txt = [strrep(handles.item{iFile},'_','-'),' Fz = ',num2str(Fz(1,iLoad)),' - \gamma = ', num2str(rad2deg(gamma(1,iGamma)))];
plot(handles.axes1,SA,Fy,'DisplayName',txt)
this because txt was a char of a different length while looping on iFile, iLoad, etc.
I'd like to migrate this to the App, but it looks like that 'DisplayName' is no longer a property supported by UIAxes (Graphics Support in App Designer - MATLAB & Simulink - MathWorks Deutschland)
And I cannot use legend, as the length is changing. Well, I could create the legend before, but I have 3 nested loops. Pretty ugly to see them twice. I'm sure there is a more clever way.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 16 Jun. 2021
Tested.
fig = uifigure();
ax = axes(fig);
h = plot(ax, rand(1,5), 'displayname', 'test');
legend(ax, 'show')
The key here is that 'DisplayName' is not an axes property: it is a Chart property.

Weitere Antworten (0)

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by