pRF_prepdata_avg.m 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. function pRF_prepdata_avg(SessionList,doUpsample)
  2. % collects data, concatenates, downsamples stimulus and resaves
  3. % NB: won't run on macbook unless there's a USB-drive with all data
  4. % Extra regressor are not possible because we're averaging the BOLD here
  5. % z-score per voxel and average over runs in a session
  6. %% WHICH DATA =============================================================
  7. %clear all; clc;
  8. if nargin <2
  9. fprintf('Not enough arguments specified, will use defaults:\n');
  10. fprintf('SessionList: pRF_PrepDatalist_M01\n');
  11. pRF_PrepDatalist_M01;
  12. %pRF_PrepDatalist_M02;
  13. doUpsample = true;
  14. else
  15. eval(SessionList);
  16. end
  17. %% Sweep to volume mapping ------------------------------------------------
  18. TR = 2.5;
  19. SwVolMap_230 = { ... % 15 blanks / 20 steps
  20. 1 , 6:25 ;...
  21. 2 , 41:60 ;...
  22. 3 , 61:80 ;...
  23. 4 , 96:115 ;...
  24. 5 , 116:135 ;...
  25. 6 , 151:170 ;...
  26. 7 , 171:190 ;...
  27. 8 , 206:225 };
  28. SwVolMap_210 = { ... % also for 215 vols
  29. 1 , 6:25 ;... % 10 blanks / 20 steps
  30. 2 , 36:55 ;...
  31. 3 , 56:75 ;...
  32. 4 , 86:105 ;...
  33. 5 , 106:125 ;...
  34. 6 , 136:155 ;...
  35. 7 , 156:175 ;...
  36. 8 , 186:205 };
  37. SwVolMap_218 = { ... % 12 blanks / 20 steps
  38. 1 , 6:25 ;...
  39. 2 , 38:57 ;...
  40. 3 , 58:77 ;...
  41. 4 , 90:109 ;...
  42. 5 , 110:129 ;...
  43. 6 , 142:161 ;...
  44. 7 , 162:181 ;...
  45. 8 , 194:213 };
  46. SwVolMap_436 = { ...
  47. 1 , 6:25 ;...
  48. 2 , 38:57 ;...
  49. 3 , 58:77 ;...
  50. 4 , 90:109 ;...
  51. 5 , 110:129 ;...
  52. 6 , 142:161 ;...
  53. 7 , 162:182 ;...
  54. 8 , 194:213 ;...
  55. 1 , 224:243 ;...
  56. 2 , 256:275 ;...
  57. 3 , 276:295 ;...
  58. 4 , 308:327 ;...
  59. 5 , 328:347 ;...
  60. 6 , 360:379 ;...
  61. 7 , 380:399 ;...
  62. 8 , 412:431 };
  63. Is436 = false;
  64. %% INITIALIZE =============================================================
  65. homefld = pwd;
  66. cd ../../
  67. SHARED_ROOT_FLD = pwd;
  68. cd(homefld)
  69. % Platform specific basepath
  70. tool_basepath = fullfile(SHARED_ROOT_FLD,'Toolboxes');
  71. % Link to the brain mask
  72. BrainMask_file = fullfile(SHARED_ROOT_FLD,'Preprocessed_data','manual-masks',...
  73. ['sub-' MONKEY],'func',['sub-' MONKEY '_ref_func_mask_res-1x1x1.nii']);
  74. % create a folder to save outputs in
  75. if doUpsample
  76. out_folder = fullfile(SHARED_ROOT_FLD,'Raw_data','MRI','Raw_matlab',...
  77. 'us-padded', MONKEY);
  78. else
  79. out_folder = fullfile(SHARED_ROOT_FLD,'Raw_data','MRI','Raw_matlab',...
  80. 'padded', MONKEY);
  81. end
  82. warning off %#ok<*WNOFF>
  83. [~,~,~] = mkdir(out_folder);
  84. warning on %#ok<*WNON>
  85. %% GET THE FILE-PATHS OF THE IMAGING & STIM-MASK FILES ===================
  86. % All functional runs that are preprocessed with the BIDS pipeline are
  87. % resampled to 1x1x1 mm isotropic voxels, reoriented from sphinx,
  88. % motion corrected, (potentially smoothed with 2 mm FWHM), and
  89. % registered to an example functional volume
  90. % (so they're already in a common space)
  91. % do the analysis in this functional space than we can register to hi-res
  92. % anatomical data and/or the NMT template later
  93. sessions = unique(DATA(:,1)); %#ok<*NODEF>
  94. % These BIDS-basepath files are not included because they are too large
  95. BIDS_basepath = fullfile(SHARED_ROOT_FLD,'Raw_data','MRI','Raw_nifti');
  96. monkey_path_nii = fullfile(BIDS_basepath, 'derivatives',...
  97. 'featpreproc','highpassed_files',['sub-' MONKEY]);
  98. monkey_path_stim = fullfile(BIDS_basepath,['sub-' MONKEY]);
  99. monkey_path_motion.regress = fullfile(BIDS_basepath, 'derivatives',...
  100. 'featpreproc','motion_corrected',['sub-' MONKEY]);
  101. monkey_path_motion.outlier = fullfile(BIDS_basepath, 'derivatives',...
  102. 'featpreproc','motion_outliers',['sub-' MONKEY]);
  103. for s=1:length(sessions)
  104. sess_path_nii{s} = fullfile(monkey_path_nii, ['ses-' sessions{s}(1:8)], 'func'); %#ok<*SAGROW>
  105. sess_path_stim{s} = fullfile(monkey_path_stim, ['ses-' sessions{s}(1:8)], 'func');
  106. sess_path_motreg{s} = fullfile(monkey_path_motion.regress, ['ses-' sessions{s}(1:8)], 'func');
  107. sess_path_motout{s} = fullfile(monkey_path_motion.outlier, ['ses-' sessions{s}(1:8)], 'func');
  108. runs = unique(DATA(strcmp(DATA(:,1),sessions{s}),2));
  109. for r=1:length(runs)
  110. if ispc % the ls command works differently in windows
  111. a=ls( fullfile(sess_path_nii{s},['*run-' runs{r} '*.nii.gz']));
  112. run_path_nii{s,r} = fullfile(sess_path_nii{s},a(1:end-3));
  113. b = ls( fullfile(sess_path_stim{s}, ...
  114. ['*run-' runs{r} '*model*']));
  115. run_path_stim{s,r}= fullfile(sess_path_stim{s},b,'StimMask.mat');
  116. c=ls( fullfile(sess_path_motreg{s},['*run-' runs{r} '*.param.1D']));
  117. run_path_motreg{s,r} = fullfile(sess_path_motreg{s},c);
  118. d=ls( fullfile(sess_path_motout{s},['*run-' runs{r} '*.outliers.txt']));
  119. run_path_motout{s,r} = fullfile(sess_path_motout{s},d);
  120. e = ls( fullfile(sess_path_stim{s}, ...
  121. ['*run-' runs{r} '*model*']));
  122. run_path_rew{s,r}= fullfile(sess_path_stim{s},e,'RewardEvents.txt');
  123. else
  124. a = ls( fullfile(sess_path_nii{s},['*run-' runs{r} '*.nii.gz']));
  125. run_path_nii{s,r} = a(1:end-3);
  126. run_path_nii{s,r} = run_path_nii{s,r}(1:end-1);
  127. run_path_stim{s,r} = ls( fullfile(sess_path_stim{s}, ...
  128. ['*run-' runs{r} '*model*'],'StimMask.mat'));
  129. run_path_stim{s,r} = run_path_stim{s,r}(1:end-1);
  130. run_path_motreg{s,r} = ls( fullfile(sess_path_motreg{s}, ...
  131. ['*run-' runs{r} '*.param.1D']));
  132. run_path_motreg{s,r}=run_path_motreg{s,r}(1:end-1);
  133. run_path_motout{s,r} = ls( fullfile(sess_path_motout{s}, ...
  134. ['*run-' runs{r} '*_outliers.txt']));
  135. run_path_motout{s,r}=run_path_motout{s,r}(1:end-1);
  136. run_path_rew{s,r} = ls( fullfile(sess_path_stim{s}, ...
  137. ['*run-' runs{r} '*model*'],'RewardEvents.txt'));
  138. run_path_rew{s,r}=run_path_rew{s,r}(1:end-1);
  139. end
  140. sweepinc{s,r} = DATA( ...
  141. (strcmp(DATA(:,1),sessions{s}) & strcmp(DATA(:,2),runs{r})),3);
  142. end
  143. end
  144. %% LOAD & RE-SAVE STIMULUS MASKS & NIFTI ==================================
  145. for s=1:size(run_path_stim,1) % sessions
  146. fprintf(['Processing session ' sessions{s} '\n']);
  147. rps = [];
  148. if strcmp(sessions{s},'20160721')
  149. TR=TR_3;
  150. fprintf('!!!! NB: This TR is 3s do not use in averaging !!!!\n');
  151. % should be excluded in the prepdata list
  152. end
  153. for i=1:size(run_path_stim,2)
  154. if ~isempty(run_path_stim{s,i})
  155. rps=[rps i];
  156. end
  157. end
  158. for r=rps % runs
  159. % stimulus mask -----
  160. % loads variable called stimulus (x,y,t) in volumes
  161. load(run_path_stim{s,r}(1:end-4));
  162. sinc = cell2mat(sweepinc{s,r});
  163. if size(stimulus,3) == 210 || size(stimulus,3) == 215
  164. SwVolMap = SwVolMap_210;
  165. Is436 = false;
  166. elseif size(stimulus,3) == 218
  167. SwVolMap = SwVolMap_218;
  168. Is436 = false;
  169. elseif size(stimulus,3) == 230
  170. SwVolMap = SwVolMap_230;
  171. Is436 = false;
  172. elseif size(stimulus,3) == 436
  173. SwVolMap = SwVolMap_436;
  174. Is436 = true;
  175. else
  176. error('weird number of stimulus frames');
  177. end
  178. firstvol = SwVolMap{min(sinc),2}(1) - 5;
  179. lastvol = SwVolMap{max(sinc),2}(end) + 5;
  180. v_inc=firstvol:lastvol;
  181. v_all=1:size(stimulus,3);
  182. bin_vinc = zeros(1,size(stimulus,3));
  183. bin_vinc(v_inc) = 1;
  184. % volumes ------
  185. %fprintf('Unpacking nii.gz');
  186. %uz_nii=gunzip(run_path_nii{s,r});
  187. % >>> Unpacking is slow from within matlab. Do this in the system
  188. temp_nii=load_nii(run_path_nii{s,r});%load_nii(uz_nii{1});
  189. %delete(uz_nii{1});
  190. fprintf(' ...done\n');
  191. % save the session-based stims & vols -----
  192. for v=1:size(stimulus,3)
  193. % resample image (160x160 pix gives 10 pix/deg)
  194. s_run(r).stim{v} = imresize(stimulus(:,:,v_all(v)),[160 160]);
  195. s_run(r).vol{v} = temp_nii.img(:,:,:,v_all(v));
  196. if v==1
  197. s_run(r).hdr = temp_nii.hdr;
  198. end
  199. end
  200. % create nan volume/stim to pad with
  201. nanVol=nan(size(temp_nii.img(:,:,:,1)));
  202. nanStim=nan(160);
  203. % pad everything to 230 volumes
  204. p_run(r).stim = cell(1,230);
  205. p_run(r).vol = cell(1,230);
  206. p_run(r).hdr = s_run(r).hdr;
  207. p_run(r).inc = zeros(1,230);
  208. if Is436
  209. shiftruns=max(rps);
  210. p_run(r+shiftruns).stim = cell(1,230);
  211. p_run(r+shiftruns).vol = cell(1,230);
  212. p_run(r+shiftruns).hdr = s_run(r).hdr;
  213. p_run(r+shiftruns).inc = zeros(1,230);
  214. end
  215. if size(stimulus,3) <= 215 % 210/215
  216. p_run(r).stim = [ ...
  217. s_run(r).stim(1:SwVolMap{2,2}(1)-1) ...
  218. nanStim nanStim nanStim nanStim nanStim ....
  219. s_run(r).stim(SwVolMap{2,2}(1):SwVolMap{4,2}(1)-1) ...
  220. nanStim nanStim nanStim nanStim nanStim ....
  221. s_run(r).stim(SwVolMap{4,2}(1):SwVolMap{6,2}(1)-1) ...
  222. nanStim nanStim nanStim nanStim nanStim ....
  223. s_run(r).stim(SwVolMap{6,2}(1):SwVolMap{8,2}(1)-1) ...
  224. nanStim nanStim nanStim nanStim nanStim ....
  225. s_run(r).stim(SwVolMap{8,2}(1):SwVolMap{8,2}(end)+5) ...
  226. ];
  227. p_run(r).inc = [ ...
  228. bin_vinc(1:SwVolMap{2,2}(1)-1) ...
  229. 0 0 0 0 0 ....
  230. bin_vinc(SwVolMap{2,2}(1):SwVolMap{4,2}(1)-1) ...
  231. 0 0 0 0 0 ....
  232. bin_vinc(SwVolMap{4,2}(1):SwVolMap{6,2}(1)-1) ...
  233. 0 0 0 0 0 ....
  234. bin_vinc(SwVolMap{6,2}(1):SwVolMap{8,2}(1)-1) ...
  235. 0 0 0 0 0 ....
  236. bin_vinc(SwVolMap{8,2}(1):SwVolMap{8,2}(end)+5) ...
  237. ];
  238. p_run(r).vol = [ ...
  239. s_run(r).vol(1:SwVolMap{2,2}(1)-1) ...
  240. nanVol nanVol nanVol nanVol nanVol ....
  241. s_run(r).vol(SwVolMap{2,2}(1):SwVolMap{4,2}(1)-1) ...
  242. nanVol nanVol nanVol nanVol nanVol ....
  243. s_run(r).vol(SwVolMap{4,2}(1):SwVolMap{6,2}(1)-1) ...
  244. nanVol nanVol nanVol nanVol nanVol ....
  245. s_run(r).vol(SwVolMap{6,2}(1):SwVolMap{8,2}(1)-1) ...
  246. nanVol nanVol nanVol nanVol nanVol ....
  247. s_run(r).vol(SwVolMap{8,2}(1):SwVolMap{8,2}(end)+5) ...
  248. ];
  249. % add 5 blanks
  250. elseif size(stimulus,3) == 218
  251. p_run(r).stim = [ ...
  252. s_run(r).stim(1:SwVolMap{2,2}(1)-1) ...
  253. nanStim nanStim nanStim ....
  254. s_run(r).stim(SwVolMap{2,2}(1):SwVolMap{4,2}(1)-1) ...
  255. nanStim nanStim nanStim ...
  256. s_run(r).stim(SwVolMap{4,2}(1):SwVolMap{6,2}(1)-1) ...
  257. nanStim nanStim nanStim ....
  258. s_run(r).stim(SwVolMap{6,2}(1):SwVolMap{8,2}(1)-1) ...
  259. nanStim nanStim nanStim ....
  260. s_run(r).stim(SwVolMap{8,2}(1):SwVolMap{8,2}(end)+5) ...
  261. ];
  262. p_run(r).inc = [ ...
  263. bin_vinc(1:SwVolMap{2,2}(1)-1) ...
  264. 0 0 0 ....
  265. bin_vinc(SwVolMap{2,2}(1):SwVolMap{4,2}(1)-1) ...
  266. 0 0 0 ....
  267. bin_vinc(SwVolMap{4,2}(1):SwVolMap{6,2}(1)-1) ...
  268. 0 0 0 ....
  269. bin_vinc(SwVolMap{6,2}(1):SwVolMap{8,2}(1)-1) ...
  270. 0 0 0 ....
  271. bin_vinc(SwVolMap{8,2}(1):SwVolMap{8,2}(end)+5) ...
  272. ];
  273. p_run(r).vol = [ ...
  274. s_run(r).vol(1:SwVolMap{2,2}(1)-1) ...
  275. nanVol nanVol nanVol ....
  276. s_run(r).vol(SwVolMap{2,2}(1):SwVolMap{4,2}(1)-1) ...
  277. nanVol nanVol nanVol ....
  278. s_run(r).vol(SwVolMap{4,2}(1):SwVolMap{6,2}(1)-1) ...
  279. nanVol nanVol nanVol ....
  280. s_run(r).vol(SwVolMap{6,2}(1):SwVolMap{8,2}(1)-1) ...
  281. nanVol nanVol nanVol ....
  282. s_run(r).vol(SwVolMap{8,2}(1):SwVolMap{8,2}(end)+5) ...
  283. ];
  284. % add 3 blanks
  285. elseif size(stimulus,3) == 230
  286. p_run(r).stim = s_run(r).stim;
  287. p_run(r).inc = bin_vinc;
  288. p_run(r).vol = s_run(r).vol;
  289. % as is
  290. elseif size(stimulus,3) == 436
  291. p_run(r).stim = [ ...
  292. s_run(r).stim(1:SwVolMap{2,2}(1)-1) ...
  293. nanStim nanStim nanStim ....
  294. s_run(r).stim(SwVolMap{2,2}(1):SwVolMap{4,2}(1)-1) ...
  295. nanStim nanStim nanStim ...
  296. s_run(r).stim(SwVolMap{4,2}(1):SwVolMap{6,2}(1)-1) ...
  297. nanStim nanStim nanStim ....
  298. s_run(r).stim(SwVolMap{6,2}(1):SwVolMap{8,2}(1)-1) ...
  299. nanStim nanStim nanStim ....
  300. s_run(r).stim(SwVolMap{8,2}(1):SwVolMap{8,2}(end)+5) ...
  301. ];
  302. p_run(r).inc = [ ...
  303. bin_vinc(1:SwVolMap{2,2}(1)-1) ...
  304. 0 0 0 ....
  305. bin_vinc(SwVolMap{2,2}(1):SwVolMap{4,2}(1)-1) ...
  306. 0 0 0 ....
  307. bin_vinc(SwVolMap{4,2}(1):SwVolMap{6,2}(1)-1) ...
  308. 0 0 0 ....
  309. bin_vinc(SwVolMap{6,2}(1):SwVolMap{8,2}(1)-1) ...
  310. 0 0 0 ....
  311. bin_vinc(SwVolMap{8,2}(1):SwVolMap{8,2}(end)+5) ...
  312. ];
  313. p_run(r).vol = [ ...
  314. s_run(r).vol(1:SwVolMap{2,2}(1)-1) ...
  315. nanVol nanVol nanVol ....
  316. s_run(r).vol(SwVolMap{2,2}(1):SwVolMap{4,2}(1)-1) ...
  317. nanVol nanVol nanVol ....
  318. s_run(r).vol(SwVolMap{4,2}(1):SwVolMap{6,2}(1)-1) ...
  319. nanVol nanVol nanVol ....
  320. s_run(r).vol(SwVolMap{6,2}(1):SwVolMap{8,2}(1)-1) ...
  321. nanVol nanVol nanVol ....
  322. s_run(r).vol(SwVolMap{8,2}(1):SwVolMap{8,2}(end)+5) ...
  323. ];
  324. p_run(r+shiftruns).stim = [ ...
  325. s_run(r).stim(SwVolMap{9,2}(1)-5:SwVolMap{10,2}(1)-1) ...
  326. nanStim nanStim nanStim ....
  327. s_run(r).stim(SwVolMap{10,2}(1):SwVolMap{12,2}(1)-1) ...
  328. nanStim nanStim nanStim ...
  329. s_run(r).stim(SwVolMap{12,2}(1):SwVolMap{14,2}(1)-1) ...
  330. nanStim nanStim nanStim ....
  331. s_run(r).stim(SwVolMap{14,2}(1):SwVolMap{16,2}(1)-1) ...
  332. nanStim nanStim nanStim ....
  333. s_run(r).stim(SwVolMap{16,2}(1):SwVolMap{16,2}(end)+5) ...
  334. ];
  335. p_run(r+shiftruns).inc = [ ...
  336. bin_vinc(1:SwVolMap{2,2}(1)-1) ...
  337. 0 0 0 ....
  338. bin_vinc(SwVolMap{2,2}(1):SwVolMap{4,2}(1)-1) ...
  339. 0 0 0 ....
  340. bin_vinc(SwVolMap{4,2}(1):SwVolMap{6,2}(1)-1) ...
  341. 0 0 0 ....
  342. bin_vinc(SwVolMap{6,2}(1):SwVolMap{8,2}(1)-1) ...
  343. 0 0 0 ....
  344. bin_vinc(SwVolMap{8,2}(1):SwVolMap{8,2}(end)+5) ...
  345. ];
  346. p_run(r+shiftruns).vol = [ ...
  347. s_run(r).vol(SwVolMap{9,2}(1)-5:SwVolMap{10,2}(1)-1) ...
  348. nanVol nanVol nanVol ....
  349. s_run(r).vol(SwVolMap{10,2}(1):SwVolMap{12,2}(1)-1) ...
  350. nanVol nanVol nanVol ....
  351. s_run(r).vol(SwVolMap{12,2}(1):SwVolMap{14,2}(1)-1) ...
  352. nanVol nanVol nanVol ....
  353. s_run(r).vol(SwVolMap{14,2}(1):SwVolMap{16,2}(1)-1) ...
  354. nanVol nanVol nanVol ....
  355. s_run(r).vol(SwVolMap{16,2}(1):SwVolMap{16,2}(end)+5) ...
  356. ];
  357. % split and add 3 blanks
  358. end
  359. clear stimulus temp_nii
  360. % if requested, upsample temporal resolution
  361. if doUpsample
  362. % stim ---
  363. tempstim = p_run(r).stim;
  364. ups_stim = cell(1,2*length(tempstim));
  365. ups_stim(1:2:end) = tempstim;
  366. ups_stim(2:2:end) = tempstim;
  367. p_run(r).stim = ups_stim;
  368. clear tempstim ups_stim
  369. % selected timepoints
  370. tempinc = p_run(r).inc;
  371. ups_inc = nan(1,2*length(tempinc));
  372. ups_inc(1:2:end) = tempinc;
  373. ups_inc(2:2:end) = tempinc;
  374. p_run(r).inc = ups_inc;
  375. % bold ---
  376. us_nii=[];
  377. for v=1:length(p_run(r).vol)
  378. us_nii=cat(4,us_nii,p_run(r).vol{v});
  379. end
  380. fprintf('Upsampling BOLD data...\n');
  381. us_nii = tseriesinterp(us_nii,TR,TR/2,4);
  382. for v=1:size(us_nii,4)
  383. p_run(r).vol{v} = us_nii(:,:,:,v);
  384. end
  385. clear us_nii
  386. if Is436
  387. % stim ---
  388. tempstim = p_run(r+shiftruns).stim;
  389. ups_stim = cell(1,2*length(tempstim));
  390. ups_stim(1:2:end) = tempstim;
  391. ups_stim(2:2:end) = tempstim;
  392. p_run(r+shiftruns).stim = ups_stim;
  393. clear tempstim ups_stim
  394. % selected timepoints
  395. tempinc = p_run(r+shiftruns).inc;
  396. ups_inc = nan(1,2*length(tempinc));
  397. ups_inc(1:2:end) = tempinc;
  398. ups_inc(2:2:end) = tempinc;
  399. p_run(r+shiftruns).inc = ups_inc;
  400. % bold ---
  401. us_nii=[];
  402. for v=1:length(p_run(r+shiftruns).vol)
  403. us_nii=cat(4,us_nii,p_run(r+shiftruns).vol{v});
  404. end
  405. fprintf('Upsampling BOLD data...\n');
  406. us_nii = tseriesinterp(us_nii,TR,TR/2,4);
  407. for v=1:size(us_nii,4)
  408. p_run(r+shiftruns).vol{v} = us_nii(:,:,:,v);
  409. end
  410. clear us_nii
  411. end
  412. end
  413. end
  414. fprintf(['Saving ses-' sessions{s} '\n']);
  415. save(fullfile(out_folder, ['ses-' sessions{s} '-230vols']),'p_run','-v7.3');
  416. fprintf('Saved result in code folder. Please move it manually...\n')
  417. clear s_run p_run
  418. end