-
Notifications
You must be signed in to change notification settings - Fork 0
/
spm12_r7771.patch
903 lines (903 loc) · 28 KB
/
spm12_r7771.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
diff -u0 -rN /opt/spm12/fcnchk.m /opt/spm12/fcnchk.m
--- /opt/spm12/fcnchk.m 1970-01-01 01:00:00.000000000 +0100
+++ /opt/spm12/fcnchk.m 2020-01-15 11:15:10.021765906 +0000
@@ -0,0 +1,15 @@
+########################################################################
+##
+## COMPATIBILITY FILE FOR GNU OCTAVE
+##
+## DELETE IF USING MATLAB OR IF USING A VERSION OF OCTAVE THAT ALREADY
+## INCLUDES THIS FUNCTION
+##
+########################################################################
+function fun = fcnchk (fun, varargin)
+if (ischar (fun))
+ fun = str2func (fun);
+elseif (isnumeric (fun))
+ error ('Invalid input.');
+endif
+endfunction
diff -u0 -rN /opt/spm12/gui_mainfcn.m /opt/spm12/gui_mainfcn.m
--- /opt/spm12/gui_mainfcn.m 1970-01-01 01:00:00.000000000 +0100
+++ /opt/spm12/gui_mainfcn.m 2020-01-15 11:15:17.345786112 +0000
@@ -0,0 +1,45 @@
+########################################################################
+##
+## COMPATIBILITY FILE FOR GNU OCTAVE
+##
+## DELETE IF USING MATLAB OR IF USING A VERSION OF OCTAVE THAT ALREADY
+## INCLUDES THIS FUNCTION
+##
+########################################################################
+function varargout = gui_mainfcn (gui_state, varargin)
+
+ if (nargin == 1 || isempty (gui_state.gui_Callback))
+ ## Open figure
+ copies = ifelse (gui_state.gui_Singleton, "reuse", "new");
+ if (isempty (gui_state.gui_LayoutFcn))
+ filename = file_in_loadpath ([gui_state.gui_Name ".fig"]);
+ H = openfig (filename, copies, "invisible");
+ else
+ H = feval (gui_LayoutFcn, copies);
+ endif
+
+ ## Set figure properties from input
+ for i = 1:2:numel (varargin)
+ try
+ set (H, varargin{i}, varargin{i+1});
+ catch
+ break;
+ end_try_catch
+ endfor
+
+ ## Store graphics handles in guidata
+ handles = guihandles (H);
+ guidata (H, handles);
+
+ ## Execute opening function
+ feval (gui_state.gui_OpeningFcn, H, [], handles, varargin{:});
+ set (H, "visible", "on");
+ handles = guidata (H);
+
+ ## Execute output function
+ varargout{1} = feval (gui_state.gui_OutputFcn, H, [], handles);
+ else
+ [varargout{1:nargout}] = feval (gui_state.gui_Callback, varargin{2:end});
+ endif
+
+endfunction
diff -u0 -rN /opt/spm12/matlabbatch/private/inputdlg.m /opt/spm12/matlabbatch/private/inputdlg.m
--- /opt/spm12/matlabbatch/private/inputdlg.m 2015-12-11 10:17:11.341841000 +0000
+++ /opt/spm12/matlabbatch/private/inputdlg.m 1970-01-01 01:00:00.000000000 +0100
@@ -1,442 +0,0 @@
-function Answer=inputdlg(Prompt, Title, NumLines, DefAns, Resize)
-%INPUTDLG Input dialog box.
-% ANSWER = INPUTDLG(PROMPT) creates a modal dialog box that returns user
-% input for multiple prompts in the cell array ANSWER. PROMPT is a cell
-% array containing the PROMPT strings.
-%
-% INPUTDLG uses UIWAIT to suspend execution until the user responds.
-%
-% ANSWER = INPUTDLG(PROMPT,NAME) specifies the title for the dialog.
-%
-% ANSWER = INPUTDLG(PROMPT,NAME,NUMLINES) specifies the number of lines for
-% each answer in NUMLINES. NUMLINES may be a constant value or a column
-% vector having one element per PROMPT that specifies how many lines per
-% input field. NUMLINES may also be a matrix where the first column
-% specifies how many rows for the input field and the second column
-% specifies how many columns wide the input field should be.
-%
-% ANSWER = INPUTDLG(PROMPT,NAME,NUMLINES,DEFAULTANSWER) specifies the
-% default answer to display for each PROMPT. DEFAULTANSWER must contain
-% the same number of elements as PROMPT and must be a cell array of
-% strings.
-%
-% ANSWER = INPUTDLG(PROMPT,NAME,NUMLINES,DEFAULTANSWER,OPTIONS) specifies
-% additional options. If OPTIONS is the string 'on', the dialog is made
-% resizable. If OPTIONS is a structure, the fields Resize, WindowStyle, and
-% Interpreter are recognized. Resize can be either 'on' or
-% 'off'. WindowStyle can be either 'normal' or 'modal'. Interpreter can be
-% either 'none' or 'tex'. If Interpreter is 'tex', the prompt strings are
-% rendered using LaTeX.
-%
-% Examples:
-%
-% prompt={'Enter the matrix size for x^2:','Enter the colormap name:'};
-% name='Input for Peaks function';
-% numlines=1;
-% defaultanswer={'20','hsv'};
-%
-% answer=inputdlg(prompt,name,numlines,defaultanswer);
-%
-% options.Resize='on';
-% options.WindowStyle='normal';
-% options.Interpreter='tex';
-%
-% answer=inputdlg(prompt,name,numlines,defaultanswer,options);
-%
-% See also DIALOG, ERRORDLG, HELPDLG, LISTDLG, MSGBOX,
-% QUESTDLG, TEXTWRAP, UIWAIT, WARNDLG .
-
-% Copyright 1994-2007 The MathWorks, Inc.
-% $Revision: 6641 $
-
-%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Handle Input Args %%%
-%%%%%%%%%%%%%%%%%%%%%%%%%
-if nargin<1
- Prompt='Input:';
-end
-if ~iscell(Prompt)
- Prompt={Prompt};
-end
-NumQuest=numel(Prompt);
-
-
-if nargin<2,
- Title=' ';
-end
-
-if nargin<3
- NumLines=1;
-end
-
-if nargin<4
- DefAns=cell(NumQuest,1);
- for lp=1:NumQuest
- DefAns{lp}='';
- end
-end
-
-if nargin<5
- Resize = 'off';
-end
-WindowStyle='modal';
-Interpreter='none';
-
-Options = struct([]); %#ok
-if nargin==5 && isstruct(Resize)
- Options = Resize;
- Resize = 'off';
- if isfield(Options,'Resize'), Resize=Options.Resize; end
- if isfield(Options,'WindowStyle'), WindowStyle=Options.WindowStyle; end
- if isfield(Options,'Interpreter'), Interpreter=Options.Interpreter; end
-end
-
-[rw,cl]=size(NumLines);
-OneVect = ones(NumQuest,1);
-if (rw == 1 & cl == 2) %#ok Handle []
- NumLines=NumLines(OneVect,:);
-elseif (rw == 1 & cl == 1) %#ok
- NumLines=NumLines(OneVect);
-elseif (rw == 1 & cl == NumQuest) %#ok
- NumLines = NumLines';
-elseif (rw ~= NumQuest | cl > 2) %#ok
- cfg_message('MATLAB:inputdlg:IncorrectSize', 'NumLines size is incorrect.')
-end
-
-if ~iscell(DefAns),
- cfg_message('MATLAB:inputdlg:InvalidDefaultAnswer', 'Default Answer must be a cell array of strings.');
-end
-
-%%%%%%%%%%%%%%%%%%%%%%%
-%%% Create InputFig %%%
-%%%%%%%%%%%%%%%%%%%%%%%
-FigWidth=175;
-FigHeight=100;
-FigPos(3:4)=[FigWidth FigHeight]; %#ok
-FigColor=get(0,'DefaultUicontrolBackgroundcolor');
-
-InputFig=dialog( ...
- 'Visible' ,'off' , ...
- 'KeyPressFcn' ,@doFigureKeyPress, ...
- 'Name' ,Title , ...
- 'Pointer' ,'arrow' , ...
- 'Units' ,'pixels' , ...
- 'UserData' ,'Cancel' , ...
- 'Tag' ,Title , ...
- 'HandleVisibility' ,'callback' , ...
- 'Color' ,FigColor , ...
- 'NextPlot' ,'add' , ...
- 'WindowStyle' ,WindowStyle, ...
- 'DoubleBuffer' ,'on' , ...
- 'Resize' ,Resize ...
- );
-
-
-%%%%%%%%%%%%%%%%%%%%%
-%%% Set Positions %%%
-%%%%%%%%%%%%%%%%%%%%%
-DefOffset = 5;
-DefBtnWidth = 53;
-DefBtnHeight = 23;
-
-TextInfo.Units = 'pixels' ;
-TextInfo.FontSize = get(0,'FactoryUIControlFontSize');
-TextInfo.FontWeight = get(InputFig,'DefaultTextFontWeight');
-TextInfo.HorizontalAlignment= 'left' ;
-TextInfo.HandleVisibility = 'callback' ;
-
-StInfo=TextInfo;
-StInfo.Style = 'text' ;
-StInfo.BackgroundColor = FigColor;
-
-
-EdInfo=StInfo;
-EdInfo.FontWeight = get(InputFig,'DefaultUicontrolFontWeight');
-EdInfo.Style = 'edit';
-EdInfo.BackgroundColor = 'white';
-
-BtnInfo=StInfo;
-BtnInfo.FontWeight = get(InputFig,'DefaultUicontrolFontWeight');
-BtnInfo.Style = 'pushbutton';
-BtnInfo.HorizontalAlignment = 'center';
-
-% Add VerticalAlignment here as it is not applicable to the above.
-TextInfo.VerticalAlignment = 'bottom';
-TextInfo.Color = get(0,'FactoryUIControlForegroundColor');
-
-
-% adjust button height and width
-btnMargin=1.4;
-ExtControl=uicontrol(InputFig ,BtnInfo , ...
- 'String' ,'OK' , ...
- 'Visible' ,'off' ...
- );
-
-% BtnYOffset = DefOffset;
-BtnExtent = get(ExtControl,'Extent');
-BtnWidth = max(DefBtnWidth,BtnExtent(3)+8);
-BtnHeight = max(DefBtnHeight,BtnExtent(4)*btnMargin);
-delete(ExtControl);
-
-% Determine # of lines for all Prompts
-TxtWidth=FigWidth-2*DefOffset;
-ExtControl=uicontrol(InputFig ,StInfo , ...
- 'String' ,'' , ...
- 'Position' ,[ DefOffset DefOffset 0.96*TxtWidth BtnHeight ] , ...
- 'Visible' ,'off' ...
- );
-
-WrapQuest=cell(NumQuest,1);
-QuestPos=zeros(NumQuest,4);
-
-for ExtLp=1:NumQuest
- if size(NumLines,2)==2
- [WrapQuest{ExtLp},QuestPos(ExtLp,1:4)]= ...
- textwrap(ExtControl,Prompt(ExtLp),NumLines(ExtLp,2));
- else
- [WrapQuest{ExtLp},QuestPos(ExtLp,1:4)]= ...
- textwrap(ExtControl,Prompt(ExtLp),80);
- end
-end % for ExtLp
-
-delete(ExtControl);
-QuestWidth =QuestPos(:,3);
-QuestHeight=QuestPos(:,4);
-
-TxtHeight=QuestHeight(1)/size(WrapQuest{1,1},1);
-EditHeight=TxtHeight*NumLines(:,1);
-EditHeight(NumLines(:,1)==1)=EditHeight(NumLines(:,1)==1)+4;
-
-FigHeight=(NumQuest+2)*DefOffset + ...
- BtnHeight+sum(EditHeight) + ...
- sum(QuestHeight);
-
-TxtXOffset=DefOffset;
-
-QuestYOffset=zeros(NumQuest,1);
-EditYOffset=zeros(NumQuest,1);
-QuestYOffset(1)=FigHeight-DefOffset-QuestHeight(1);
-EditYOffset(1)=QuestYOffset(1)-EditHeight(1);
-
-for YOffLp=2:NumQuest,
- QuestYOffset(YOffLp)=EditYOffset(YOffLp-1)-QuestHeight(YOffLp)-DefOffset;
- EditYOffset(YOffLp)=QuestYOffset(YOffLp)-EditHeight(YOffLp);
-end % for YOffLp
-
-QuestHandle=[]; %#ok
-EditHandle=[];
-
-AxesHandle=axes('Parent',InputFig,'Position',[0 0 1 1],'Visible','off');
-
-inputWidthSpecified = false;
-
-lfont = cfg_get_defaults('cfg_ui.lfont');
-
-for lp=1:NumQuest,
- if ~ischar(DefAns{lp}),
- delete(InputFig);
- %cfg_message('Default Answer must be a cell array of strings.');
- cfg_message('MATLAB:inputdlg:InvalidInput', 'Default Answer must be a cell array of strings.');
- end
-
- EditHandle(lp)=uicontrol(InputFig , ...
- EdInfo , ...
- 'Max' ,NumLines(lp,1) , ...
- 'Position' ,[ TxtXOffset EditYOffset(lp) TxtWidth EditHeight(lp) ], ...
- 'String' ,DefAns{lp} , ...
- 'Tag' ,'Edit' , ...
- lfont{:});
-
- QuestHandle(lp)=text('Parent' ,AxesHandle, ...
- TextInfo , ...
- 'Position' ,[ TxtXOffset QuestYOffset(lp)], ...
- 'String' ,WrapQuest{lp} , ...
- 'Interpreter',Interpreter , ...
- 'Tag' ,'Quest' ...
- );
-
- MinWidth = max(QuestWidth(:));
- if (size(NumLines,2) == 2)
- % input field width has been specified.
- inputWidthSpecified = true;
- EditWidth = setcolumnwidth(EditHandle(lp), NumLines(lp,1), NumLines(lp,2));
- MinWidth = max(MinWidth, EditWidth);
- end
- FigWidth=max(FigWidth, MinWidth+2*DefOffset);
-
-end % for lp
-
-% fig width may have changed, update the edit fields if they dont have user specified widths.
-if ~inputWidthSpecified
- TxtWidth=FigWidth-2*DefOffset;
- for lp=1:NumQuest
- set(EditHandle(lp), 'Position', [TxtXOffset EditYOffset(lp) TxtWidth EditHeight(lp)]);
- end
-end
-
-FigPos=get(InputFig,'Position');
-
-FigWidth=max(FigWidth,2*(BtnWidth+DefOffset)+DefOffset);
-FigPos(1)=0;
-FigPos(2)=0;
-FigPos(3)=FigWidth;
-FigPos(4)=FigHeight;
-
-set(InputFig,'Position',getnicedialoglocation(FigPos,get(InputFig,'Units')));
-
-OKHandle=uicontrol(InputFig , ...
- BtnInfo , ...
- 'Position' ,[ FigWidth-2*BtnWidth-2*DefOffset DefOffset BtnWidth BtnHeight ] , ...
- 'KeyPressFcn',@doControlKeyPress , ...
- 'String' ,'OK' , ...
- 'Callback' ,@doCallback , ...
- 'Tag' ,'OK' , ...
- 'UserData' ,'OK' ...
- );
-
-setdefaultbutton(InputFig, OKHandle);
-
-CancelHandle=uicontrol(InputFig , ...
- BtnInfo , ...
- 'Position' ,[ FigWidth-BtnWidth-DefOffset DefOffset BtnWidth BtnHeight ] , ...
- 'KeyPressFcn',@doControlKeyPress , ...
- 'String' ,'Cancel' , ...
- 'Callback' ,@doCallback , ...
- 'Tag' ,'Cancel' , ...
- 'UserData' ,'Cancel' ...
- ); %#ok
-
-handles = guihandles(InputFig);
-handles.MinFigWidth = FigWidth;
-handles.FigHeight = FigHeight;
-handles.TextMargin = 2*DefOffset;
-guidata(InputFig,handles);
-set(InputFig,'ResizeFcn', {@doResize, inputWidthSpecified});
-
-% make sure we are on screen
-movegui(InputFig)
-
-% if there is a figure out there and it's modal, we need to be modal too
-if ~isempty(gcbf) && strcmp(get(gcbf,'WindowStyle'),'modal')
- set(InputFig,'WindowStyle','modal');
-end
-
-set(InputFig,'Visible','on');
-drawnow;
-
-if ~isempty(EditHandle)
- uicontrol(EditHandle(1));
-end
-
-if ishandle(InputFig)
- % Go into uiwait if the figure handle is still valid.
- % This is mostly the case during regular use.
- uiwait(InputFig);
-end
-
-% Check handle validity again since we may be out of uiwait because the
-% figure was deleted.
-if ishandle(InputFig)
- Answer={};
- if strcmp(get(InputFig,'UserData'),'OK'),
- Answer=cell(NumQuest,1);
- for lp=1:NumQuest,
- Answer(lp)=get(EditHandle(lp),{'String'});
- end
- end
- delete(InputFig);
-else
- Answer={};
-end
-
-function doFigureKeyPress(obj, evd) %#ok
-switch(evd.Key)
- case {'return','space'}
- set(gcbf,'UserData','OK');
- uiresume(gcbf);
- case {'escape'}
- delete(gcbf);
-end
-
-function doControlKeyPress(obj, evd) %#ok
-switch(evd.Key)
- case {'return'}
- if ~strcmp(get(obj,'UserData'),'Cancel')
- set(gcbf,'UserData','OK');
- uiresume(gcbf);
- else
- delete(gcbf)
- end
- case 'escape'
- delete(gcbf)
-end
-
-function doCallback(obj, evd) %#ok
-if ~strcmp(get(obj,'UserData'),'Cancel')
- set(gcbf,'UserData','OK');
- uiresume(gcbf);
-else
- delete(gcbf)
-end
-
-function doResize(FigHandle, evd, multicolumn) %#ok
-% TBD: Check difference in behavior w/ R13. May need to implement
-% additional resize behavior/clean up.
-
-Data=guidata(FigHandle);
-
-resetPos = false;
-
-FigPos = get(FigHandle,'Position');
-FigWidth = FigPos(3);
-FigHeight = FigPos(4);
-
-if FigWidth < Data.MinFigWidth
- FigWidth = Data.MinFigWidth;
- FigPos(3) = Data.MinFigWidth;
- resetPos = true;
-end
-
-% make sure edit fields use all available space if
-% number of columns is not specified in dialog creation.
-if ~multicolumn
- for lp = 1:length(Data.Edit)
- EditPos = get(Data.Edit(lp),'Position');
- EditPos(3) = FigWidth - Data.TextMargin;
- set(Data.Edit(lp),'Position',EditPos);
- end
-end
-
-if FigHeight ~= Data.FigHeight
- FigPos(4) = Data.FigHeight;
- resetPos = true;
-end
-
-if resetPos
- set(FigHandle,'Position',FigPos);
-end
-
-
-% set pixel width given the number of columns
-function EditWidth = setcolumnwidth(object, rows, cols)
-% Save current Units and String.
-old_units = get(object, 'Units');
-old_string = get(object, 'String');
-old_position = get(object, 'Position');
-
-set(object, 'Units', 'pixels')
-set(object, 'String', char(ones(1,cols)*'x'));
-
-new_extent = get(object,'Extent');
-if (rows > 1)
- % For multiple rows, allow space for the scrollbar
- new_extent = new_extent + 19; % Width of the scrollbar
-end
-new_position = old_position;
-new_position(3) = new_extent(3) + 1;
-set(object, 'Position', new_position);
-
-% reset string and units
-set(object, 'String', old_string, 'Units', old_units);
-
-EditWidth = new_extent(3);
diff -u0 -rN /opt/spm12/matlabbatch/private/listdlg.m /opt/spm12/matlabbatch/private/listdlg.m
--- /opt/spm12/matlabbatch/private/listdlg.m 2015-12-11 10:17:11.341841000 +0000
+++ /opt/spm12/matlabbatch/private/listdlg.m 1970-01-01 01:00:00.000000000 +0100
@@ -1,265 +0,0 @@
-function [selection,value] = listdlg(varargin)
-%LISTDLG List selection dialog box.
-% [SELECTION,OK] = LISTDLG('ListString',S) creates a modal dialog box
-% which allows you to select a string or multiple strings from a list.
-% SELECTION is a vector of indices of the selected strings (length 1 in
-% the single selection mode). This will be [] when OK is 0. OK is 1 if
-% you push the OK button, or 0 if you push the Cancel button or close the
-% figure.
-%
-% Double-clicking on an item or pressing <CR> when multiple items are
-% selected has the same effect as clicking the OK button. Pressing <CR>
-% is the same as clicking the OK button. Pressing <ESC> is the same as
-% clicking the Cancel button.
-%
-% Inputs are in parameter,value pairs:
-%
-% Parameter Description
-% 'ListString' cell array of strings for the list box.
-% 'SelectionMode' string; can be 'single' or 'multiple'; defaults to
-% 'multiple'.
-% 'ListSize' minimum [width height] of listbox in pixels; defaults
-% to [160 300]. The maximum [width height] is fixed to
-% [800 600].
-% 'InitialValue' vector of indices of which items of the list box
-% are initially selected; defaults to the first item.
-% 'Name' String for the figure's title; defaults to ''.
-% 'PromptString' string matrix or cell array of strings which appears
-% as text above the list box; defaults to {}.
-% 'OKString' string for the OK button; defaults to 'OK'.
-% 'CancelString' string for the Cancel button; defaults to 'Cancel'.
-%
-% A 'Select all' button is provided in the multiple selection case.
-%
-% Example:
-% d = dir;
-% str = {d.name};
-% [s,v] = listdlg('PromptString','Select a file:',...
-% 'SelectionMode','single',...
-% 'ListString',str)
- %
-% See also DIALOG, ERRORDLG, HELPDLG, INPUTDLG,
-% MSGBOX, QUESTDLG, WARNDLG.
-
-% Copyright 1984-2005 The MathWorks, Inc.
-% $Revision: 6641 $ $Date: 2005/10/28 15:54:55 $
-
-% 'uh' uicontrol button height, in pixels; default = 22.
-% 'fus' frame/uicontrol spacing, in pixels; default = 8.
-% 'ffs' frame/figure spacing, in pixels; default = 8.
-
-% simple test:
-%
-% d = dir; [s,v] = listdlg('PromptString','Select a file:','ListString',{d.name});
-%
-
-figname = '';
-smode = 2; % (multiple)
-promptstring = {};
-liststring = [];
-listsize = [160 300];
-initialvalue = [];
-okstring = 'OK';
-cancelstring = 'Cancel';
-fus = 8;
-ffs = 8;
-uh = 22;
-
-if mod(length(varargin),2) ~= 0
- % input args have not com in pairs, woe is me
- cfg_message('MATLAB:listdlg:InvalidArgument', 'Arguments to LISTDLG must come param/value in pairs.')
-end
-for i=1:2:length(varargin)
- switch lower(varargin{i})
- case 'name'
- figname = varargin{i+1};
- case 'promptstring'
- promptstring = varargin{i+1};
- case 'selectionmode'
- switch lower(varargin{i+1})
- case 'single'
- smode = 1;
- case 'multiple'
- smode = 2;
- end
- case 'listsize'
- listsize = varargin{i+1};
- case 'liststring'
- liststring = varargin{i+1};
- case 'initialvalue'
- initialvalue = varargin{i+1};
- case 'uh'
- uh = varargin{i+1};
- case 'fus'
- fus = varargin{i+1};
- case 'ffs'
- ffs = varargin{i+1};
- case 'okstring'
- okstring = varargin{i+1};
- case 'cancelstring'
- cancelstring = varargin{i+1};
- otherwise
- cfg_message('MATLAB:listdlg:UnknownParameter', ['Unknown parameter name passed to LISTDLG. Name was ' varargin{i}])
- end
-end
-
-if ischar(promptstring)
- promptstring = cellstr(promptstring);
-end
-
-if isempty(initialvalue)
- initialvalue = 1;
-end
-
-if isempty(liststring)
- cfg_message('MATLAB:listdlg:NeedParameter', 'ListString parameter is required.')
-end
-
-liststring=cellstr(liststring);
-lfont = cfg_get_defaults('cfg_ui.lfont');
-bfont = cfg_get_defaults('cfg_ui.bfont');
-tmpObj = uicontrol('style','listbox',...
- 'max',100,...
- 'Visible','off',...
- lfont{:});
-lext = cfg_maxextent(tmpObj, liststring);
-ex = get(tmpObj,'Extent');
-ex = ex(4);
-delete(tmpObj);
-listsize = min([800 600],max(listsize, [max(lext)+16, ex*numel(liststring)]));
-
-fp = get(0,'defaultfigureposition');
-w = 2*(fus+ffs)+listsize(1);
-h = 2*ffs+6*fus+ex*length(promptstring)+listsize(2)+uh+(smode==2)*(fus+uh);
-fp = [fp(1) fp(2)+fp(4)-h w h]; % keep upper left corner fixed
-
-fig_props = { ...
- 'name' figname ...
- 'color' get(0,'defaultUicontrolBackgroundColor') ...
- 'resize' 'off' ...
- 'numbertitle' 'off' ...
- 'menubar' 'none' ...
- 'windowstyle' 'modal' ...
- 'visible' 'off' ...
- 'createfcn' '' ...
- 'position' fp ...
- 'closerequestfcn' 'delete(gcbf)' ...
- };
-
-fig = figure(fig_props{:});
-
-if ~isempty(promptstring)
- prompt_text = uicontrol('style','text','string',promptstring,...
- 'horizontalalignment','left',...
- 'position',[ffs+fus fp(4)-(ffs+fus+ex*length(promptstring)) ...
- listsize(1) ex*length(promptstring)]); %#ok
-end
-
-btn_wid = (fp(3)-2*(ffs+fus)-fus)/2;
-
-listbox = uicontrol('style','listbox',...
- 'position',[ffs+fus ffs+uh+4*fus+(smode==2)*(fus+uh) listsize],...
- 'string',liststring,...
- 'backgroundcolor','w',...
- 'max',smode,...
- 'tag','listbox',...
- 'value',initialvalue, ...
- 'callback', {@doListboxClick}, ...
- lfont{:});
-
-ok_btn = uicontrol('style','pushbutton',...
- 'string',okstring,...
- 'position',[ffs+fus ffs+fus btn_wid uh],...
- 'callback',{@doOK,listbox},...
- bfont{:});
-
-cancel_btn = uicontrol('style','pushbutton',...
- 'string',cancelstring,...
- 'position',[ffs+2*fus+btn_wid ffs+fus btn_wid uh],...
- 'callback',{@doCancel,listbox},...
- bfont{:});
-
-if smode == 2
- selectall_btn = uicontrol('style','pushbutton',...
- 'string','Select all',...
- 'position',[ffs+fus 4*fus+ffs+uh listsize(1) uh],...
- 'tag','selectall_btn',...
- 'callback',{@doSelectAll, listbox});
-
- if length(initialvalue) == length(liststring)
- set(selectall_btn,'enable','off')
- end
- set(listbox,'callback',{@doListboxClick, selectall_btn})
-end
-
-set([fig, ok_btn, cancel_btn, listbox], 'keypressfcn', {@doKeypress, listbox});
-
-set(fig,'position',getnicedialoglocation(fp, get(fig,'Units')));
-% Make ok_btn the default button.
-setdefaultbutton(fig, ok_btn);
-
-% make sure we are on screen
-movegui(fig)
-set(fig, 'visible','on'); drawnow;
-
-try
- % Give default focus to the listbox *after* the figure is made visible
- uicontrol(listbox);
- uiwait(fig);
-catch
- if ishandle(fig)
- delete(fig)
- end
-end
-
-if isappdata(0,'ListDialogAppData__')
- ad = getappdata(0,'ListDialogAppData__');
- selection = ad.selection;
- value = ad.value;
- rmappdata(0,'ListDialogAppData__')
-else
- % figure was deleted
- selection = [];
- value = 0;
-end
-
-%% figure, OK and Cancel KeyPressFcn
-function doKeypress(src, evd, listbox) %#ok
-switch evd.Key
- case 'escape'
- doCancel([],[],listbox);
-end
-
-%% OK callback
-function doOK(ok_btn, evd, listbox) %#ok
-if (~isappdata(0, 'ListDialogAppData__'))
- ad.value = 1;
- ad.selection = get(listbox,'value');
- setappdata(0,'ListDialogAppData__',ad);
- delete(gcbf);
-end
-
-%% Cancel callback
-function doCancel(cancel_btn, evd, listbox) %#ok
-ad.value = 0;
-ad.selection = [];
-setappdata(0,'ListDialogAppData__',ad)
-delete(gcbf);
-
-%% SelectAll callback
-function doSelectAll(selectall_btn, evd, listbox) %#ok
-set(selectall_btn,'enable','off')
-set(listbox,'value',1:length(get(listbox,'string')));
-
-%% Listbox callback
-function doListboxClick(listbox, evd, selectall_btn) %#ok
-% if this is a doubleclick, doOK
-if strcmp(get(gcbf,'SelectionType'),'open')
- doOK([],[],listbox);
-elseif nargin == 3
- if length(get(listbox,'string'))==length(get(listbox,'value'))
- set(selectall_btn,'enable','off')
- else
- set(selectall_btn,'enable','on')
- end
-end
diff -u0 -rN /opt/spm12/rng.m /opt/spm12/rng.m
--- /opt/spm12/rng.m 1970-01-01 01:00:00.000000000 +0100
+++ /opt/spm12/rng.m 2020-01-15 11:14:52.917718717 +0000
@@ -0,0 +1,107 @@
+########################################################################
+##
+## COMPATIBILITY FILE FOR GNU OCTAVE
+##
+## DELETE IF USING MATLAB OR IF USING A VERSION OF OCTAVE THAT ALREADY
+## INCLUDES THIS FUNCTION
+##
+########################################################################
+function retval = rng (varargin)
+
+ if (nargin > 2 || nargout > 1)
+ print_usage ();
+ endif
+
+ ## Store current settings of random number generator
+ ## FIXME: there doesn't seem to be a way to query the type of generator
+ ## currently used in Octave - assume "twister".
+ ## FIXME: there doesn't seem to be a way to query the seed initialization
+ ## value - use "Not applicable".
+ ## FIXME: rand and randn use different generators - storing both states.
+ ## For older Matlab generators (v4, v5), the settings are stored like this:
+ ## struct ("Type","Legacy", "Seed", "Not applicable", "State",{[],[],...})
+ s = struct (...
+ "Type", "twister",... # generator name
+ "Seed", "Not applicable",... # seed initialization value
+ "State", {{rand("state"), randn("state")}}); # internal state of the generator
+
+ if (! nargin)
+ retval = s;
+ return;
+ endif
+
+ if (isscalar (varargin{1}) && isnumeric (varargin{1}) && isreal (varargin{1}) && varargin{1} >= 0)
+ s_rand = s_randn = varargin{1};
+ generator = check_generator (varargin(2:end));
+
+ elseif (ischar (varargin{1}) && strcmpi (varargin{1}, "shuffle"))
+ ## Seed the random number generator based on the current time
+ s_rand = s_randn = "reset"; # or sum (1000*clock)
+ generator = check_generator (varargin(2:end));
+
+ elseif (ischar (varargin{1}) && strcmpi (varargin{1}, "default") && nargin == 1)
+ generator = "twister";
+ s_rand = s_randn = 0; # In Matlab, seed 0 corresponds to 5489
+
+ elseif (isstruct (varargin{1}) && isscalar (varargin{1}) && nargin == 1)
+ if (numfields (varargin{1}) != 3 || ! isfield (varargin{1}, "Type")
+ || ! isfield (varargin{1}, "Seed") || ! isfield (varargin{1}, "State"))
+ error ("Input structure not compatible with the one returned by rng ()");
+ endif
+ ## Only the internal state "State" and generator type "Type" are needed
+ generator = varargin{1}.Type;
+ if (iscell (varargin{1}.State))
+ [s_rand, s_randn] = deal (varargin{1}.State{:});
+ else
+ s_rand = s_randn = varargin{1}.State;
+ endif
+
+ else
+ print_usage ();
+ endif
+
+ ## Set the type of random number generator and seed it
+ if (isempty (generator))
+ generator = s.Type;
+ endif
+ switch generator
+ case "twister"
+ rand ("state", s_rand);
+ randn ("state", s_randn);
+
+ case "legacy"
+ rand ("seed", s_rand);
+ randn ("seed", s_randn);
+
+ case "v5uniform"
+ rand ("seed", s_rand);
+
+ case "v5normal"
+ randn ("seed", s_randn);
+
+ otherwise
+ error ("Unknown type of random number generator");
+
+ endswitch
+
+ if (nargout > 0)
+ retval = s;
+ endif
+
+endfunction
+
+
+function gen = check_generator (val)
+ if (isempty (val))
+ gen = "";
+ return;
+ elseif (! iscellstr (val))
+ error ("Second input must be a type of random number generator");
+ endif
+ gen = tolower (char (val));
+ if (ismember (gen, {"simdtwister", "combrecursive", "philox", "threefry", "multfibonacci", "v4"}))
+ error ("This random number generator is not available in Octave");
+ elseif (! ismember (gen, {"twister", "v5uniform", "v5normal"}))
+ error ("This type of random number generator is unknown");
+ endif
+endfunction
diff -u0 -rN /opt/spm12/toolbox/Shoot/spm_shoot_greens.m /opt/spm12/toolbox/Shoot/spm_shoot_greens.m
--- /opt/spm12/toolbox/Shoot/spm_shoot_greens.m
+++ /opt/spm12/toolbox/Shoot/spm_shoot_greens.m
@@ -103 +103 @@
- v(:,:,:,i) = ifftn(F.*fftn(m(:,:,:,i))./prm(i)^2,'symmetric');
+ v(:,:,:,i) = real(ifftn(F.*fftn(m(:,:,:,i))./prm(i)^2));
@@ -116 +116 @@
- v(:,:,:,j) = ifftn(a,'symmetric');
+ v(:,:,:,j) = real(ifftn(a));