フィルターのクリア

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 Center および File ExchangeSpecifying 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