plot graph to GUI from m-file

10 Ansichten (letzte 30 Tage)
Teemu Juujärvi
Teemu Juujärvi am 15 Sep. 2015
Kommentiert: Adam am 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

Antworten (2)

Tim Jackman
Tim Jackman am 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 am 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 Kommentare
Teemu Juujärvi
Teemu Juujärvi am 17 Sep. 2015
Yes it takes the handle as x data. How I can avoid that or draw it correctly?
Adam
Adam am 18 Sep. 2015
Just pass the axes handle instead of the gui handle

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by