diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..21229f76b17b687525514038ec23a451ae85a716 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.asv \ No newline at end of file diff --git a/SaveTranscriptions.m b/SaveTranscriptions.m index efb41fc91816d22bea1bdb1706c228b27fc9f47c..10fba75f4d1c4ba25adf997e10c669c7c81e90b3 100644 --- a/SaveTranscriptions.m +++ b/SaveTranscriptions.m @@ -1,36 +1,49 @@ -% I am not happy with how these files work - - -% 1. load in the transcribed file + the original -% 2. Purge the labels from the original - % resetLabelValues(lss) -% 3. Copy the transcribed labels to the original - % setLabelValue? - -% For testing +%% For testing load('C:\Users\chris\Box\Nelson Lab Data\Other Data\NTAud Transcription\Transcript_OrigAudio_AudSentStim.mat', 'lss'); test = load('C:\Users\chris\Box\Nelson Lab Data\Other Data\NTAud Transcription\Transcript_Version2_AudSent.mat'); ls = test.lss; -% Search the workspace for ls and lss +%% Main code +% Search the workspace for ls and lss and check for the tracker +if ~ValidWorkspace(ls, lss); return; end -% Remove labels for lss -resetLabelValues(lss) +% Update progress + % Compare ls and lss roi and values -% Relable lss using ls -nTrials = height(test.lss.Labels); -for iTrial = 1:nTrials - nWords = height(test.lss.Labels.Words{iTrial}); - setLabelValue(lss, iTrial, 'Words', test.lss.Labels.Words{iTrial}.ROILimits, test.lss.Labels.Words{iTrial}.Value) +% Transfer labels +lss = TransferLabels(ls, lss); + +% Save lss and progress + % use uiget element to select save location + +%% Functions +function extStatus = ValidWorkspace(ls, lss) + +if ~exist("ls", "var") + fprintf(2, 'No exported transcript found. Please export your transciription to the work space as ''ls''\n') + extStatus = false; + return end -% +if ~exist("lss", 'var') + fprintf(2, 'The original transcription file is missing, please ensure the work you have done is saved to ''ls'' and load in the original transcription\n'); + extStatus = false; + return +end + +extStatus = true; + +end -% Code will be run after student saves the file to the workspace - % Check workspace to find ls, lss, and +function lss = TransferLabels(ls, lss) -% add functionality to check if sessions have been edited compare ROI and -% script +% Clear lss labels +resetLabelValues(lss) + +% Move ls labels to lss +nTrials = height(ls.Labels); +for iTrial = 1:nTrials + setLabelValue(lss, iTrial, 'Words', ls.Labels.Words{iTrial}.ROILimits, ls.Labels.Words{iTrial}.Value) +end -% Save the file and save the current progress - % Use a uiget element to delect save location +end \ No newline at end of file