Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 清除列表框中的变量_Matlab_User Interface - Fatal编程技术网

Matlab 清除列表框中的变量

Matlab 清除列表框中的变量,matlab,user-interface,Matlab,User Interface,我制作了一个列表框来访问工作区中的变量。我想要 通过突出显示变量从工作区中清除某些变量 在列表框中。有人能告诉我怎么做吗?下面是一个GUI示例: function clear_vars_gui %# create user interface hFig = figure('Name','Clear Variables', 'NumberTitle','off', ... 'Menubar','none', 'Position',[300 300 200 300])

我制作了一个列表框来访问工作区中的变量。我想要 通过突出显示变量从工作区中清除某些变量
在列表框中。有人能告诉我怎么做吗?

下面是一个GUI示例:

function clear_vars_gui
    %# create user interface
    hFig = figure('Name','Clear Variables', 'NumberTitle','off', ...
        'Menubar','none', 'Position',[300 300 200 300]);
    hList = uicontrol('style','listbox', 'Min',1, 'Max',10, ...
        'Units','normalized', 'Position',[0 0.1 1 0.9], 'Parent',hFig);
    uicontrol('style','push', 'String','clear', 'Callback',@button_cb, ...
        'Units','normalized', 'Position',[0 0 1 0.1], 'Parent',hFig);

    %# initialize listbox
    populateList();

    function populateList()
        %# populate listbox with variable names
        vars = evalin('base','who');
        set(hList, 'String',vars, 'Value',1)
        drawnow
    end
    function button_cb(o,e)
        %# get list of variables and the currently selected items
        vars = get(hList, 'String');
        idx = get(hList, 'Value');
        if isempty(vars), return; end

        %# filter to selected vars
        vars = vars(idx);

        %# clear variables in base workspace
        evalin('base', ['clearvars ' sprintf('%s ',vars{:})]);

        %# update listbox
        populateList();
    end
end

这是我的GUI,我想创建pushbotton来清除工作区中的一些变量;不选择列表框中的任何内容;谢谢你没有给出什么描述,也没有代码,所以我必须拿出我自己的例子。请学习上面的代码,并将其应用于您自己的GUI。。。在没有看到您所做的工作之前,很难提供帮助。farTHANKS Amro,我还有一个问题,如何使用GUI修改三相断路器的过渡时间参数,第三个问题,如果我有三相PI截面线的冲击Z=0.045+j0.033和y=0+j0.023,我如何计算正序和零序电阻(欧姆/公里)[r1 r0]、电感和电容?@SidaliChaib:嗯,我不确定这与上面的内容有什么关系!请单独提出一个问题寻求帮助,记住标记上面的内容,就好像你认为它解决了你的GUI问题一样。。