Effacer les filtres
Effacer les filtres

plot graph to GUI from m-file

2 vues (au cours des 30 derniers jours)
Teemu Juujärvi
Teemu Juujärvi le 15 Sep 2015
Commenté : Adam le 18 Sep 2015
Hi,
I have succesfully plotted some graphs to GUI from m-file by using handle (in m-file) like this: plot(GUI_handle, variable, '-', 'color', [ 104 113 122 ]/255, 'linewidth', 2 ); But now I want to plot graph from two variables like this: plot(GUI_handle, variable1, variable2, '-', 'color', [ 104 113 122 ]/255, 'linewidth', 2 ); This should plot x-y graph from variable values, but it gives error message: Error using plot Vectors must be the same length.
Variables have the same length and normal plot draws graph like it should: figure(1) plot (variable1, variable2) How can I get this plot to GUI?
Teemu

Réponses (2)

Tim Jackman
Tim Jackman le 17 Sep 2015
I can't seem to reproduce this. If I create a simple GUI with an axes object in it, I can plot an x vector or an x and y vector just fine as long as I have specified the handle to the axes object correctly (for me, the handle for the axes object was handles.axes1).
Could this issue be related to the handle you are supplying to the plot command?

Adam
Adam le 17 Sep 2015
The first argument to plot is either an axes handle or the x data. I'm not sure why your original code works, to be honest, as you seem to imply you are passing in the GUI handle rather than the axes handle.
Probably in the second case it is trying to take your GUI handle as the x data and the 2nd argument as the y data.
  2 commentaires
Teemu Juujärvi
Teemu Juujärvi le 17 Sep 2015
Yes it takes the handle as x data. How I can avoid that or draw it correctly?
Adam
Adam le 18 Sep 2015
Just pass the axes handle instead of the gui handle

Connectez-vous pour commenter.

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by