From a09f2e3a077bd87b12c8e8bbd3f024fcb707dedf Mon Sep 17 00:00:00 2001 From: "Chuang, Yun-Shiuan" Date: Thu, 1 Mar 2018 17:58:08 -0600 Subject: [PATCH 1/3] Edit the color bar setting Edit the color bar setting to make it compatible with Matlab version newer than R2015a. --- +rsa/figureRDMs.m | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/+rsa/figureRDMs.m b/+rsa/figureRDMs.m index c647aef..59b4853 100644 --- a/+rsa/figureRDMs.m +++ b/+rsa/figureRDMs.m @@ -33,7 +33,10 @@ function figureRDMs(RDMs, userOptions, localOptions) % ranks preserved. If false, true values are represented. % Defaults to true. This is for display only. % userOptions.colourScheme -% A colour scheme for the RDMs. Defualts to jet(64). +% A colour scheme for the RDMs. For Matlab version +% before R2015b, +% defualts to jet(64); for versions afterward, +% defaults to colormap(jet(256)). % % localOptions --- Further options. % localOptions.figureNumber @@ -48,17 +51,24 @@ function figureRDMs(RDMs, userOptions, localOptions) %__________________________________________________________________________ % Copyright (C) 2010 Medical Research Council -import rsa.* -import rsa.fig.* -import rsa.fmri.* -import rsa.rdm.* -import rsa.sim.* -import rsa.spm.* -import rsa.stat.* +import rsa.* +import rsa.fig.* +import rsa.fmri.* +import rsa.rdm.* +import rsa.sim.* +import rsa.spm.* +import rsa.stat.* import rsa.util.* returnHere = pwd; - +% Detect Matlab version (R2015b changes default color maps: should use +% colormap() to specify the color of the color bar. +matlabVersion = str2num(cell2mat(regexp(version('-release'),'\d+','match'))); +if matlabVersion>2015 + color=colormap(jet(256)); +else + color=jet(64); +end %% Set defaults and check options struct if nargin == 2, localOptions = struct(); end%if:nargin if ~isfield(userOptions, 'analysisName'), error('figureInterleavedRDMs:NoAnalysisName', 'analysisName must be set. See help'); end%if @@ -68,7 +78,7 @@ function figureRDMs(RDMs, userOptions, localOptions) userOptions = setIfUnset(userOptions, 'saveFigureFig', false); userOptions = setIfUnset(userOptions, 'displayFigures', true); userOptions = setIfUnset(userOptions, 'rankTransform', true); -userOptions = setIfUnset(userOptions, 'colourScheme', jet(64)); +userOptions = setIfUnset(userOptions, 'colourScheme', color); if ~isfield(userOptions,'dpi'), userOptions.dpi=300; end; if ~isfield(userOptions,'tightInset') From cfd3f3d9d201c047a687767ed97647e46028efaa Mon Sep 17 00:00:00 2001 From: Cai Date: Wed, 21 Mar 2018 14:17:19 +0000 Subject: [PATCH 2/3] Fixed typo. Many thanks to Markus Aichhorn for reporting this error. --- +rsa/+fmri/fMRIDataPreparation.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/+rsa/+fmri/fMRIDataPreparation.m b/+rsa/+fmri/fMRIDataPreparation.m index b37e512..18eec44 100644 --- a/+rsa/+fmri/fMRIDataPreparation.m +++ b/+rsa/+fmri/fMRIDataPreparation.m @@ -69,7 +69,7 @@ if ~isfield(userOptions, 'rootPath'), error('fMRIDataPreparation:NoRootPath', 'rootPath must be set. See help'); end%if if ~isfield(userOptions, 'betaPath'), error('fMRIDataPreparation:NoBetaPath', 'betaPath must be set. See help'); end%if if ~isfield(userOptions, 'subjectNames'), error('fMRIDataPreparation:NoSubjectNames', 'subjectNames must be set. See help'); end%if -if (~isfield(userOptions, 'conditionLabels') && ischar(betaCorrespondence) && strcpmi(betaCorrespondence, 'SPM')), error('fMRIDataPreparation:NoConditionLabels', 'conditionLables must be set if the data is being extracted from SPM.'); end%if +if (~isfield(userOptions, 'conditionLabels') && ischar(betaCorrespondence) && strcmpi(betaCorrespondence, 'SPM')), error('fMRIDataPreparation:NoConditionLabels', 'conditionLables must be set if the data is being extracted from SPM.'); end%if % The filenames contain the analysisName as specified in the user options file ImageDataFilename = [userOptions.analysisName, '_ImageData.mat']; From 29fe77828131777b0706f69594120b3426e9d18e Mon Sep 17 00:00:00 2001 From: "Chuang, Yun-Shiuan" Date: Sat, 31 Mar 2018 14:59:02 -0500 Subject: [PATCH 3/3] Enable dotSize in the MDS plot to be adjustable In the original version, dotSize in the MDS plot could not be adjusted by users. Reason identified: The dotSize parameter is stored in userOption instead of localOptions, but the old script mistakenly tried to retrieve the dotSize information from the localOption. I edited the code so that dotSize is now rerived from the correct variable. --- +rsa/+fig/figureMDSArrangement.m | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/+rsa/+fig/figureMDSArrangement.m b/+rsa/+fig/figureMDSArrangement.m index a392bc3..d01b1f6 100644 --- a/+rsa/+fig/figureMDSArrangement.m +++ b/+rsa/+fig/figureMDSArrangement.m @@ -93,13 +93,13 @@ function figureMDSArrangement(RDM, userOptions, localOptions) %__________________________________________________________________________ % Copyright (C) 2010 Medical Research Council -import rsa.* -import rsa.fig.* -import rsa.fmri.* -import rsa.rdm.* -import rsa.sim.* -import rsa.spm.* -import rsa.stat.* +import rsa.* +import rsa.fig.* +import rsa.fmri.* +import rsa.rdm.* +import rsa.sim.* +import rsa.spm.* +import rsa.stat.* import rsa.util.* %% define defaults @@ -172,8 +172,8 @@ function figureMDSArrangement(RDM, userOptions, localOptions) % categories undefined: plot all text labels in black veryLocalOptions.textLabels = localOptions.textLabels; veryLocalOptions.dotColours = localOptions.dotColours; - if isfield(localOptions, 'dotSize') - veryLocalOptions.dotSize = localOptions.dotSize; + if isfield(userOptions, 'dotSize') + veryLocalOptions.dotSize = userOptions.dotSize; end%if plotDotsWithTextLabels(pats_mds_2D,veryLocalOptions);