matlab数据游标的使用,在Matlab GUI中获取数据游标回调

我没有发现在GUI和图中使用数据光标之间有任何区别.

重新使用部分代码,我创建了一个GUI,其中一个复选框启用/禁用datacursormode.

GUI包含两个轴,其中分别绘制两条线和3D表面.

此外,还有三个radiobuttons控制将在启用datacursormode时生成的文本框中打印的字符串.

GUI的标签如下:

>左轴:axes_2d

>右轴:axes_3d

>左按钮:pushbutton_2d

>右按钮:pushbutton_3d

>复选框:checkbox_enable_dc

> left radiobutton:radiobutton1

>中间放射线:radiobutton2

> righ radiobutton:radiobutton3

GUI以这种方式工作:

>按钮在轴上绘制并启用复选框

>复选框启用/禁用datacursormode

>默认情况下,左侧单选按钮被选中并设置默认字符串

>另外两个radiobutton设置了不同的字符串

根据选定的单选按钮,文本框中字符串的第一行将是:

>默认字符串

> STRING OPTION ONE

> STRING OPTION TWO

要在文本框中写入的字符串是在myupdatefcn中创建的,该文件已被修改以处理由radiobutton选择的选项.

注意:为了不限制对myupdatefcn函数版本的修改,我对t数组进行了硬编码.

这是GUI的.m文件:

function varargout = gui_datacursormode(varargin)

% GUI_DATACURSORMODE MATLAB code for gui_datacursormode.fig

% GUI_DATACURSORMODE, by itself, creates a new GUI_DATACURSORMODE or raises the existing

% singleton*.

%

% H = GUI_DATACURSORMODE returns the handle to a new GUI_DATACURSORMODE or the handle to

% the existing singleton*.

%

% GUI_DATACURSORMODE('CALLBACK',hObject,eventData,handles,...) calls the local

% function named CALLBACK in GUI_DATACURSORMODE.M with the given input arguments.

%

% GUI_DATACURSORMODE('Property','Value',...) creates a new GUI_DATACURSORMODE or raises the

% existing singleton*. Starting from the left, property value pairs are

% applied to the GUI before gui_datacursormode_OpeningFcn gets called. An

%

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值