Skip to content

Commit 37d5ae8

Browse files
authored
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.
1 parent 5fd7163 commit 37d5ae8

File tree

6 files changed

+47
-5
lines changed

6 files changed

+47
-5
lines changed

DataTree/Examples/EditStimExample.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function EditStimExample(dataSetDir)
8282

8383
pause(2);
8484

85-
EditEventsTsvFile_InMatlabEditor(obj, dataSetDir);
85+
obj.EditStim();
8686

8787
obj.ClosePlots();
8888
dataTree.ReloadStim();

DataTree/TreeNodeClass.m

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,49 @@ function ReloadStim(obj)
548548

549549

550550

551+
% ----------------------------------------------------------------------------------
552+
function EditStim(obj)
553+
if isempty(obj.acquired)
554+
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)]));
555+
return;
556+
end
557+
filenameData = [obj.path, obj.GetFilename()];
558+
[p,f] = fileparts(filenameData);
559+
560+
% From data file name get events TSV file and load in matlab editor
561+
filenameEvents = [p, '/', f, '_events.tsv'];
562+
obj.logger.Write('Editing %s\n', filenameEvents);
563+
564+
% Edit commands
565+
if ~isdeployed()
566+
edit(filenameEvents);
567+
editorTabs = matlab.desktop.editor.getAll;
568+
569+
% Search for editor tab containing loaded file and make it active
570+
for ii = 1:length(editorTabs)
571+
if pathscompare(editorTabs(ii).Filename, filenameEvents)
572+
break
573+
end
574+
end
575+
editorTab = editorTabs(ii);
576+
editorTab.makeActive;
577+
% MenuBox('Please edit TSV stim file and save it, then click the ''OK'' button.');
578+
else
579+
if ispc()
580+
cmd = sprintf('start notepad %s', filenameEvents);
581+
obj.logger.Write('cmd: "%s"', cmd);
582+
system(cmd);
583+
elseif ismac()
584+
cmd = sprintf('open -a TextEdit %s', filenameEvents);
585+
obj.logger.Write('cmd: "%s"', cmd);
586+
system(cmd);
587+
% 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));
588+
end
589+
end
590+
end
591+
592+
593+
551594
% --------------------------------------------------------------
552595
function CopyStimAcquired(obj)
553596
obj.procStream.CopyStims(obj.acquired);

Docs/DesignNotes.ppt

0 Bytes
Binary file not shown.

MainGUI/MainGUI.fig

526 Bytes
Binary file not shown.

MainGUI/MainGUI.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,6 +2197,4 @@ function menuItemExportStim_Callback(~, ~, ~)
21972197
% --------------------------------------------------------------------
21982198
function menuItemReloadStim_Callback(hObject, ~, handles)
21992199
global maingui
2200-
maingui.dataTree.ReloadStim();
2201-
DisplayData(handles, hObject);
2202-
2200+
maingui.dataTree.currElem.EditStim();

Version.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
1.70.1
1+
1.71.0
2+

0 commit comments

Comments
 (0)