From 98eb2930d1efb9130b824815d97eec8ce3b561bb Mon Sep 17 00:00:00 2001 From: cll008 Date: Thu, 28 Oct 2021 13:57:42 -0700 Subject: [PATCH] GUI update: reformat char to string for tInfo and gInfo fix #95. also add .txt extension to README. tested to work with p300 dataset. --- bids_export.m | 2 +- pop_taskinfo.m | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bids_export.m b/bids_export.m index 4368808..6a6748f 100644 --- a/bids_export.m +++ b/bids_export.m @@ -481,7 +481,7 @@ function bids_export(files, varargin) % --------------------------- if ~isempty(opt.README) if exist(opt.README) ~= 2 - fid = fopen(fullfile(opt.targetdir, 'README'), 'w'); + fid = fopen(fullfile(opt.targetdir, 'README.txt'), 'w'); if fid == -1, error('Cannot write README file'); end fprintf(fid, '%s', opt.README); fclose(fid); diff --git a/pop_taskinfo.m b/pop_taskinfo.m index 77c4363..5f651ee 100644 --- a/pop_taskinfo.m +++ b/pop_taskinfo.m @@ -192,7 +192,11 @@ function okCB(src,event) if strcmp(objs(i).Tag, 'ReferencesAndLinks') || strcmp(objs(i).Tag, 'Authors') gInfo.(objs(i).Tag) = {objs(i).String}; else - gInfo.(objs(i).Tag) = objs(i).String; + tmp = objs(i).String; + if ndims(tmp) > 1 && size(tmp,1) > 1 + tmp = reformatchartostring(tmp); + end + gInfo.(objs(i).Tag) = tmp; end else if strcmp(objs(i).Style, 'popupmenu') @@ -210,7 +214,11 @@ function okCB(src,event) tmp.FilterDescription.Description = objs(i).String; tInfo.(objs(i).Tag) = tmp; else - tInfo.(objs(i).Tag) = objs(i).String; + tmp = objs(i).String; + if ndims(tmp) > 1 && size(tmp,1) > 1 + tmp = reformatchartostring(tmp); + end + tInfo.(objs(i).Tag) = tmp; end end end @@ -340,4 +348,10 @@ function preFill() function editedCB(src,event) end + + function string_out = reformatchartostring(char_in) + char_in(1:end-1,end+1) = newline; + char_in = char_in'; + string_out = char_in(:)'; + end end \ No newline at end of file