Azzera filtri
Azzera filtri

Error setting property 'YLabel' of class 'Axes':

59 visualizzazioni (ultimi 30 giorni)
hans
hans il 29 Giu 2022
Commentato: Voss il 29 Giu 2022
I'm getting the error message:
Error setting property 'YLabel' of class 'Axes':
Value must be 'matlab.graphics.Graphics'
figure;
ax = gca;
ax.YLabel = "[Pressure [Pa]]" ;
I do not understand the contents of the error message
What is wrong with the value, I try to assign?
I don't get any error message if I just use
ylabel('[Pressure [Pa]]')

Risposta accettata

Voss
Voss il 29 Giu 2022
The YLabel is a text object. You mean to set its String property:
figure;
ax = gca;
ax.YLabel.String = "[Pressure [Pa]]" ;
You can see other properties of ax.YLabel you might want to set as well (though not all of them are settable):
disp(properties(ax.YLabel))
{'Color' } {'Position' } {'String' } {'Interpreter' } {'Extent' } {'Rotation' } {'FontName' } {'FontUnits' } {'FontSize' } {'FontAngle' } {'FontWeight' } {'HorizontalAlignment'} {'VerticalAlignment' } {'EdgeColor' } {'LineStyle' } {'LineWidth' } {'BackgroundColor' } {'Margin' } {'Editing' } {'Clipping' } {'FontSmoothing' } {'Interactions' } {'Units' } {'Children' } {'Parent' } {'Visible' } {'HandleVisibility' } {'ButtonDownFcn' } {'ContextMenu' } {'BusyAction' } {'BeingDeleted' } {'Interruptible' } {'CreateFcn' } {'DeleteFcn' } {'Type' } {'Tag' } {'UserData' } {'Selected' } {'SelectionHighlight' } {'HitTest' } {'PickableParts' }
  6 Commenti
hans
hans il 29 Giu 2022
Thank You again, supporting my understanding.

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by