Unverified Commit 37d5ae8d authored by jayd1860's avatar jayd1860 Committed by GitHub
Browse files

Development (#156)

* v1.71.0

-- Add EditStim method to TreeNodeClass to allow editing of events TSV files for the processing element.
-- Change menu option "Load Stim from TSV" to "Edit Stim TSV file", so that user doesn't have to go looking for the file in the dataset folder.

* -- No need to display MenuBox message after opening events TSV file in editor.
parent 5fd7163f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ obj.ExportStim();

pause(2);

EditEventsTsvFile_InMatlabEditor(obj, dataSetDir);
obj.EditStim();

obj.ClosePlots();
dataTree.ReloadStim();
+43 −0
Original line number Diff line number Diff line
@@ -548,6 +548,49 @@ classdef TreeNodeClass < handle
        
        
        
        % ----------------------------------------------------------------------------------
        function EditStim(obj)
            if isempty(obj.acquired)
                MenuBox(sprintf('%s level processing does not have stims. Please select a run to edit stim marks\n', [upper(obj.type(1)), obj.type(2:end)]));
                return;
            end
            filenameData = [obj.path, obj.GetFilename()];
            [p,f] = fileparts(filenameData);
            
            % From data file name get events TSV file and load in matlab editor
            filenameEvents = [p, '/', f, '_events.tsv'];
            obj.logger.Write('Editing %s\n', filenameEvents);
            
            % Edit commands
            if ~isdeployed()
                edit(filenameEvents);
                editorTabs = matlab.desktop.editor.getAll;
                
                % Search for editor tab containing loaded file and make it active
                for ii = 1:length(editorTabs)
                    if pathscompare(editorTabs(ii).Filename, filenameEvents)
                        break
                    end
                end
                editorTab = editorTabs(ii);
                editorTab.makeActive;
                % MenuBox('Please edit TSV stim file and save it, then click the ''OK'' button.');
            else
                if ispc()
                    cmd = sprintf('start notepad %s', filenameEvents);
                    obj.logger.Write('cmd:  "%s"', cmd);
                    system(cmd);
                elseif ismac()
                    cmd = sprintf('open -a TextEdit %s', filenameEvents);
                    obj.logger.Write('cmd:  "%s"', cmd);
                    system(cmd);                    
                    % MenuBox(sprintf('The events file associated with the current processing element is\n%s\n Open the file in a text editor to modify stim marks', filenameEvents));
                end
            end
        end
        
        
        
        % --------------------------------------------------------------
        function CopyStimAcquired(obj)
            obj.procStream.CopyStims(obj.acquired);
(3.48 MiB)

File changed.

No diff preview for this file type.

+526 B (98.2 KiB)

File changed.

No diff preview for this file type.

+1 −3
Original line number Diff line number Diff line
@@ -2197,6 +2197,4 @@ maingui.dataTree.currElem.ExportStim();
% --------------------------------------------------------------------
function menuItemReloadStim_Callback(hObject, ~, handles)
global maingui
maingui.dataTree.ReloadStim();
DisplayData(handles, hObject);
maingui.dataTree.currElem.EditStim();
Loading