Epileptogenicity Map Now error message

Sorry for being a gigantic pain. Thanks to Francois' and Mark's suggestions I have gone past the previous issue which was related to the a function not present in the Matlab release I was using. have made a step forward but still SPM Canonical surfaces step cannot be completed for a different error message.
This time
Matlab 2018a, Updated Brainstorm and SPM this am, recreated path as advised which now looks like this:
/Users/seris/Dropbox/Analysis_toolboxes/spm8/external/fieldtrip/utilities
/Users/seris/Dropbox/Analysis_toolboxes/spm8/external/fieldtrip/fileio
/Users/seris/.brainstorm/process
/Users/seris/.brainstorm/mex
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/anatomy
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/connectivity
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/core
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/db
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/forward
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/gui
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/inverse
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/io
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/math
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/misc
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/process
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/process/deprecated
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/process/functions
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/realtime
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/script
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/sensors
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/timefreq
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/toolbox/tree /Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/ImaGIN
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/ImaGIN/io
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/ScreenCapture
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/SurfStat
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/brainentropy
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/buzsakilab
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/dba /Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/edfimport-1.0.4
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/eeglab
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/eeprobe
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/ez_fingerprint* /Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/fieldtrip
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/fraschini
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/freesurfer
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/icp
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/intan
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/label
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/mia /Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/mne
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/mne/matlab
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/mominc
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/mosher
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/octave
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/openmeeg
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/other
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/plexon
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/ricoh
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/son-2.32
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/spm
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3/external/yokogawa
/Users/seris/Dropbox/Analysis_toolboxes/brainstorm3
/Users/seris/Documents/MATLAB* /Users/seris/Dropbox/Analysis_toolboxes/spm12

Now the error msg: (the folder spm12/canonical exists and the file is there, can open it on FSL. Adding the folder to the path doesn't change the outcome.

BST> Emptying temporary directory...

SPM12: spm_preproc_run (v7408) 10:36:56 - 23/02/2019

Segment /Users/seris/.brainstorm/tmp/spm_canonical.nii
Completed : 10:37:53 - 23/02/2019
Error using read_gifti_file (line 17)
[GIFTI] Loading of XML file /Users/seris/Dropbox/Analysis_toolboxes/spm12/canonical/cortex_20484.surf.gii
failed.

Error in gifti (line 100)
this = read_gifti_file(varargin{1},giftistruct);

Error in spm_eeg_inv_mesh (line 56)
mesh.tess_mni = export(gifti(filename), 'spm');

Error in process_generate_canonical>Compute (line 151)
spmMesh = spm_eeg_inv_mesh(NiiFile, Resolution);

Error in process_generate_canonical>ComputeInteractive (line 210)
[isOk, errMsg] = Compute(iSubject, iAnatomy, Resolution, 1);

Error in process_generate_canonical (line 28)
eval(macro_method);

Error in tree_callbacks>@(h,ev)process_generate_canonical('ComputeInteractive',iSubject,iAnatomy) (line
976)
gui_component('MenuItem', jPopup, [], 'SPM canonical surfaces',
IconLoader.ICON_SURFACE_CORTEX, [],
@(h,ev)process_generate_canonical('ComputeInteractive', iSubject, iAnatomy));

Does the file "/Users/seris/Dropbox/Analysis_toolboxes/spm12/canonical/cortex_20484.surf.gii" exist?
What do you get if you try to load it manually with by executing the following line in your Matlab command window:
gifti('/Users/seris/Dropbox/Analysis_toolboxes/spm12/canonical/cortex_20484.surf.gii')

If there is any problem with this line, there is something wrong with your SPM12 install, try to download it again after removing it from your path and deleting all the spm12 folders.

The file exists and I can open it with FSL.
If I enter the line I get the following error message

Error using read_gifti_file (line 17)
[GIFTI] Loading of XML file /Users/seris/Dropbox/Analysis_toolboxes/spm12/canonical/cortex_20484.surf.gii
failed.

Error in gifti (line 100)
this = read_gifti_file(varargin{1},giftistruct);

There is some issue with your SPM install, independent from Brainstorm, I don't know how to help you fixing this.
Clean up your Matlab path (keep only the SPM top folder and the Matlab folders, remove everything else) to make sure you don't have anything incompatible in your path.
Are you sure you are using the latest versions of SPM and Brainstorm?

If you can't find any way to make SPM work correctly, you could try with the compiled version of Brainstorm, it now includes the SPM files needed for the computation of these epileptogenicity maps. See section "without matlab" in the installation page:
https://neuroimage.usc.edu/brainstorm/Installation

Hi Francois, your diagnosis is correct but until now I couldn't figure out what it was. It is only after cleaning up and still getting an error message that I realized that the process somehow finds a mex file in the wrong folder (an SPM8 folder not under path) and adds the path to pathdef.m without the courtesy of letting me know.
As a result the mex file is incompatible.
I deleted the SPM8 folder and reconfigured everything and it now works. What an idiot.....
Ths
Stefano