Thanks a lot for your help!
I think I have modified everything needed for it to run! I'll share the .loc file I modified (please find attached in this email) and explain the parts of the code I changed for it to run! (I think it is easy enough):
roast:
line 416 -> fid = fopen('./elec72.loc'); C = textscan(fid,'%d %f %f %s'); fclose(fid);
Here you have to change the name of the .loc file for the one you created.
line 757 -> [~,indRef] = ismember('Iz',elecName);
You have to change here the reference electrode in the case the 'Iz' electrode is not included in your new subset of electrodes!
roast_target:
line 564 -> fid = fopen('./elec72.loc'); C = textscan(fid,'%d %f %f %s'); fclose(fid);
You put here the name of the new .loc file name you created.
line 631 -> mytopoplot(mon,'./elec72.loc','numcontour',0,'plotrad',0.9,'shading','flat','gridscale',1000,'whitebk','off','colormap',cm_mon);
Again, you have to change the .loc file name you created.
After doing these modifications, you have to run roast with the recipe 'leadField', and can run roast_target as you would normally do! For the 'elec32.loc' file attached in this mail, the electrode placement figure looks like this (running roast([], 'leadfield', 'simulationTag', 'MNI152leadFieldStarStim32')):
And then running roast_target([], 'MNI152leadFieldStarStim32',[],'optType','wls-l1per', 'targetingTag', '32ElecDefault') provides the following results:
Electrodes used are:
Fp1 (-0.338 mA)
C3 (1.000 mA)
C4 (-0.086 mA)
P4 (-0.170 mA)
O1 (-0.180 mA)
F7 (-0.508 mA)
FC1 (0.314 mA)
FC2 (-0.457 mA)
CP1 (0.686 mA)
AF4 (-0.101 mA)
PO4 (-0.068 mA)
Oz (-0.093 mA)
Hope this was useful!!
Martín