[FieldTrip] loading data in GUI

Leila Ayoubian leilayou_54 at yahoo.com
Mon Jan 11 11:50:01 CET 2016


Good morning everyone:
I am new to fieldtrip am having trouble loading EEG data in a GUI . While there is no trouble loading the same file in a script , when the same file is being loaded inside a simple GUI , Matlab hangs, and I have to press ctrl C to exit! I am really puzzled! I understand it could be the GUI issue and not fieldtrip function issue.I thought if someone have come across this problem can save me time.
I attached the two codes to compare. This is the script that works
************************************

clear all;
clc;
close all;
[filename, pathname] = uigetfile({'*.edf;*.e', 'Nicolete files (*.edf;*.e)'; '*.*', 'All files (*.*)'}, 'Select edf file');

if isequal(filename, 0) || isequal(pathname, 0)
    disp('Exiting...');
    return;
end

file = fullfile(pathname, filename)
cfg1 = [];
cfg1.trl = [1 61440 0];
cfg1.dataset = filename%'K_S_Event_Marker_1.edf';
 cfg1 = ft_definetrial( cfg1 );
cfg1.continuous = 'yes';
 data1 = ft_preprocessing(cfg1);
 display('Finished')
***************************** Here is the GUI code, which does not work


function varargout = loadDataGUI(varargin)

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @loadDataGUI_OpeningFcn, ...
                   'gui_OutputFcn',  @loadDataGUI_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 loadDataGUI is made visible.
function loadDataGUI_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 loadDataGUI (see VARARGIN)

% Choose default command line output for loadDataGUI
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes loadDataGUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = loadDataGUI_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;


% --- Executes on button press in loadData.
function loadData_Callback(hObject, eventdata, handles)
% hObject    handle to loadData (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


%Load the EEG file
if isempty(handles)
    disp('ERROR:::Please select a valid Montage');
end
[filename, pathname] = uigetfile({'*.edf;*.e', 'Nicolete files (*.edf;*.e)'; '*.*', 'All files (*.*)'}, 'Select edf file');

if isequal(filename, 0) || isequal(pathname, 0)
    disp('Exiting...');
    return;
end

file = fullfile(pathname, filename)
cfg1 = [];


% beginSample=1; %The indice of sample to begin
% endSample=61440; %The indice of sample to end (1 min data to load, 60*1024=61440)
% 
cfg1.trl = [1 61440 0];
cfg1.dataset = filename%'K_S_Event_Marker_1.edf';
 cfg1 = ft_definetrial( cfg1 );
cfg1.continuous = 'yes';
 data1 = ft_preprocessing(cfg1);
%set(handles.filePath,'string',file );



function filePath_Callback(hObject, eventdata, handles)
% hObject    handle to filePath (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of filePath as text
%        str2double(get(hObject,'String')) returns contents of filePath as a double
% global handles;
% display(handles.file)
 set(handles.filePath,'string',handles.file );



*************************************************************
__________________________________________________ Leila Ayoubian, PhD.
Institute of Psychiatry, Psychology and Neuroscience
King's College London
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160111/81851451/attachment-0001.html>


More information about the fieldtrip mailing list