How can I assign a histfit graph to a parent axis in a gui?

2 vues (au cours des 30 derniers jours)
Matthew Weihing
Matthew Weihing le 20 Avr 2016
Commenté : Adam Danz le 26 Nov 2019
For instance, if I type:
" plot(x,y,'parent',handles.axes1) "
this will plot x and y to axes1 in my gui, but if I type:
" histfit(data_set,number_of_bins,'parent',handles.axes1) "
(where data_set is a vector of arbitrary length and number of bins is some constant)
MATLAB tells me I have too many input arguments for histfit. I was wondering if there was a way around this error message. Thanks

Réponse acceptée

Brendan Hamm
Brendan Hamm le 20 Avr 2016
histfit always plots to the current axes.You need to make the axes you wish to place this on the current axes using:
axes(handles.axes1)
histfit(data_set,number_of_bins)
This will then appear on the axes stored in handles.axes1.
  1 commentaire
Adam Danz
Adam Danz le 26 Nov 2019
Future releases should fix this and allow users to specify the axes as an optional first input as almost all matlab graphics functions do.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by