GUI面板在运行实际程序之前加载先前的运行值

时间:2013-11-30 01:36:17

标签: matlab user-interface

我有一个面板框,应显示少数功能的值。但它显示之前运行的值,因此如何刷新它或显示最新计算的值。例如:加载先前计算的值。

我想清除工作空间,以便在运行函数之前不加载值。


function varargout = SMERCGUI_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;
imshow('D:\SMERC\Abstract Model\Phani\Essentials\SMERC.jpg');
 global amp;
 global result1;
z=amp;
varargout{1} = handles.output;
uipanel(handles.uipanel6);
t=uicontrol('parent',handles.uipanel6);
set(t,'string',z);

global rts;
 x=rts;
varargout{1} = handles.output;
uipanel(handles.uipanel7);
t=uicontrol('parent',handles.uipanel7);
set(t,'string',x);

1 个答案:

答案 0 :(得分:0)

因此,为了避免Panel显示上一次运行的值,您必须在运行matlab之前清除所有全局值。

% --- Executes just before SMERCGUI is made visible.
function SMERCGUI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to SMERCGUI (see VARARGIN)

% Choose default command line output for SMERCGUI
handles.output = hObject;
clc;
clear global;