필터 지우기
필터 지우기

plot graph to GUI from m-file

조회 수: 2 (최근 30일)
Teemu Juujärvi
Teemu Juujärvi 2015년 9월 15일
댓글: Adam 2015년 9월 18일
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

답변 (2개)

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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by