Why ' gpos.m' is not working( ginput with posiiton of the current axes)?

1 次查看(过去 30 天)
gpos.m file should work like GINPUT provided by Matlab,but it traces the position of cursor without click and is designed for 2-D axes. But Its getting error using in app designer?
Error:
Error using gpos
Too many input arguments.
Can any one help me with this?
  3 个评论
Rik
Rik 2022-9-28
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.
This page is now archived on the Wayback Machine. Unfortunatly, the attached file could not be recovered.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2022-9-21
Change
app.tfig = [app.tfig, figure('Name', 'points','WindowButtonMotionFcn',@gpos)];
to
app.tfig = [app.tfig, figure('Name', 'points','WindowButtonMotionFcn',@(src,event)gpos(ancestor(src,'axes')))];
  3 个评论
Walter Roberson
Walter Roberson 2022-9-22
I am unclear on the goal here.
Is the goal to be able to have gpos work on uiaxes (which would be in uifigure) ?
Is the goal to be able to have gpos work on traditional axes inside uifigure ?
Is the goal to be able to have gpos work on traditional axes inside traditional figures that just happen to be dynamically created inside App Designer ?
I started converting your code to use uifigure under the assumption that you would want to use gpos with (static) axes created by App Designer, but I gave up at the point where it told me that subplot() could not be used inside that kind of containers that have "automatically resize children" configured.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by