I have a problem regarding static text box in GUI

2 views (last 30 days)
SUDHANSHU
SUDHANSHU on 25 Jun 2013
I am working on EEg signals and want to develop a GUI for the same. The problem is that in static text box,i want to show all values for each iteration of for loop but it is showing only last value. Plz suggest me how we can see all values in static text box simultaneously.Secondly, I want to know how can i plot for all variables in given data. My code is:
function varargout = Data(varargin) % DATA M-file for Data.fig % DATA, by itself, creates a new DATA or raises the existing % singleton*. % % H = DATA returns the handle to a new DATA or the handle to % the existing singleton*. % % DATA('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in DATA.M with the given input arguments. % % DATA('Property','Value',...) creates a new DATA or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before Data_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to Data_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Data
% Last Modified by GUIDE v2.5 23-Jun-2013 20:56:19
% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @Data_OpeningFcn, ... 'gui_OutputFcn', @Data_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end
if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% --- Executes just before Data is made visible. function Data_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 Data (see VARARGIN)
% Choose default command line output for Data handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes Data wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = Data_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;
function edit1_Callback(hObject, eventdata, handles) global user_entry user_entry = str2double(get(hObject,'string')); if isnan(user_entry) errordlg('You must enter a numeric value','Bad Input','modal') return end display(user_entry); % --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in btn_browse. function btn_browse_Callback(hObject, eventdata, handles) [fn pn] = uigetfile('*.mat;*.m;*.xlsx;*ascii;*.txt','select EEG DATA file'); complete = strcat(pn,fn); set(handles.edit_browse,'string',complete); global file_name file_name=load(fn); global vars vars=whos('-file',fn); global lngth lngth=length(vars); display(lngth); sz=size(vars);display(sz);
function edit_browse_Callback(hObject, eventdata, handles) % --- Executes during object creation, after setting all properties. function edit_browse_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in btn_DetailData. function btn_DetailData_Callback(hObject, eventdata, handles) global Name_Var; global Size_Var; global vars;%global Name_Var;global Size_Var; global lngth; for i=1:lngth Name_Var =vars(i).name; set(gcf,handles.text_Details,'string',Name_Var);display(Name_Var); Size_Var=vars(i).size;set(handles.text_Details,'string',Size_Var);display(Size_Var); end
% --- Executes on button press in btn_PlotSignal. function btn_PlotSignal_Callback(hObject, eventdata, handles) global user_entry; fs=user_entry; display(fs); T=1/fs; %T=.002 tmax=3; Nsamps =tmax*fs; t = 0:1/fs:tmax-1/fs; global vars; [rt]=vars(4); display(rt); [rt1] =getdata(rt);display(rt1); s = rt1(1:19,1:1500); L_s = length(s); %Plot in Time Domain Original EEG figure(1) h=plot(t,s); xlabel('Time (s)') ylabel('Amplitude (microV)') title('Original Signal') ylim([-100 100]) grid on; set(h); % --- Executes during object creation, after setting all properties. function text_Details_CreateFcn(hObject, eventdata, handles)
% hObject handle to text_Details (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
Please help me.
  3 Comments
Walter Roberson
Walter Roberson on 25 Jun 2013
Are you asking to update the static text box with each new value (and only that value) as it is produced? Or are you asking that at the end, the static text box will have multiple output values recorded in it (if so then should each value be a separate line? If so then what do you want done about the fact that static text boxes do not have scroll bars?)

Sign in to comment.

Answers (1)

Ravi
Ravi on 25 Jun 2013
if values are stored in a text file... In GUIDE there is an option called Axes... u can use pushbutton & axes for plotting that data... In pushbutton callback
function pushbutton_callback(hObject, eventdata, handles)
a=load filename;
plot(a)

Community Treasure Hunt

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

Start Hunting!

Translated by