matlab-GUI程序(1)

这篇博客介绍了MATLAB中guidata函数的使用,它用于在GUI程序中存储和检索应用数据。通过示例展示了如何在回调函数中利用guidata与guihandles结合,管理和传递GUI组件的句柄及自定义数据。此外,还提及了GUIDE自动生成的回调函数如何自动处理数据结构。
摘要由CSDN通过智能技术生成



 guidata用来保存handles结构,可以做为窗口间参数的传递。

 

>> help guidata
 GUIDATA Store or retrieve application data.
    GUIDATA(H, DATA) stores the specified data in the figure's
    application data.
 
    H is a handle that identifies the figure - it can be the figure
    itself, or any object contained in the figure.
 
    DATA can be anything an application wishes to store for later
    retrieval.
 
    DATA = GUIDATA(H) returns previously stored data, or an empty
    matrix if nothing was previously stored.
 
    GUIDATA provides application authors with a convenient interface
    to a figure's application data. You can access the data from a
    callback subfunction using the component's handle, without needing
    to find the figure's handle.  You can also avoid having to create
    and maintain a hardcoded property name for the application data
    throughout your source code.  GUIDATA is particularly useful in
    conjunction with GUIHANDLES, which returns a structure containing
    handles of all the components in a GUI listed by tag.
 
    Example:
 
    Suppose an application creates a figure with handle F, containing
    a slider and an editable text uicontrol whose tags are
    'valueSlider' and 'valueEdit' respectively.  The following
    excerpts from the application's M-file illustrate the use of
    GUIDATA to access a structure containing handles returned by
    GUIHANDLES, plus additional application-specific data added during
    initialization and callbacks:
 
    ... excerpt from the GUI setup code ...
 
    f = openfig('mygui.fig');
    data = guihandles(f); % initialize it to contain handles
    data.errorString = 'Total number of mista

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值