diff options
| author | Leo Chan <leochanj@live.unc.edu> | 2020-10-22 01:53:21 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 01:56:35 -0400 |
| commit | d17b33131c14864bd1eae275f49a3f148e21cf29 (patch) | |
| tree | 0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/toolbox/toolbox_basic/stella/openfigure.m | |
| parent | 601ed25a4c5b66cb75315832c15613a727db2c26 (diff) | |
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to:
- Use libextra to loop as realtime jobs
- Preallocate memory before starting their main computation
- Accept input via stdin instead of via argc
Does not include the SD-VBS matlab code.
Fixes libextra execution in LITMUS^RT.
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/stella/openfigure.m')
| -rwxr-xr-x | SD-VBS/common/toolbox/toolbox_basic/stella/openfigure.m | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/toolbox_basic/stella/openfigure.m b/SD-VBS/common/toolbox/toolbox_basic/stella/openfigure.m new file mode 100755 index 0000000..e677014 --- /dev/null +++ b/SD-VBS/common/toolbox/toolbox_basic/stella/openfigure.m | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | % function openfigure(m,n,caption,isnew) | ||
| 2 | function h = openfigure(m,n,caption,isnew) | ||
| 3 | |||
| 4 | if nargin<3, | ||
| 5 | caption = ' '; | ||
| 6 | end | ||
| 7 | |||
| 8 | if nargin<4, | ||
| 9 | isnew = 1; | ||
| 10 | end | ||
| 11 | |||
| 12 | if (m<=0 | n<=0) | ||
| 13 | return; | ||
| 14 | end | ||
| 15 | |||
| 16 | if isnew, | ||
| 17 | h = figure; colormap(gray); | ||
| 18 | else | ||
| 19 | h = gcf; | ||
| 20 | end | ||
| 21 | clf | ||
| 22 | |||
| 23 | subplot('position',[0,0,0.1,0.1]); axis off; | ||
| 24 | text(0.1,0.15,sprintf('S. X. Yu, %s',date),'FontSize',8); | ||
| 25 | |||
| 26 | subplot('position',[0,0.96,0.1,0.1]); axis off; | ||
| 27 | text(0.1,0.15,caption,'FontSize',8); | ||
| 28 | |||
| 29 | subplot(m,n,1); | ||
| 30 | %return | ||
| 31 | |||
| 32 | if (m==1 & n==1), | ||
| 33 | return; | ||
| 34 | end | ||
| 35 | |||
| 36 | %set(gcf,'PaperPosition',[0.25, 8, 8,2.5*m]); | ||
| 37 | % set(gcf,'PaperPosition',[0.25,0.25,8,10.5]); | ||
| 38 | %return | ||
| 39 | |||
| 40 | if (m<=n), | ||
| 41 | set(gcf,'PaperOrientation','landscape','PaperPosition',[0.25,0.25,10.5,8]); | ||
| 42 | else | ||
| 43 | set(gcf,'PaperPosition',[0.25,0.25,8,10.5]); | ||
| 44 | end | ||
| 45 | |||
| 46 | % comment on PaperPosition | ||
| 47 | % [a,b,c,d] | ||
| 48 | % (a,b) is the coordinate of the lower-left corner of the figure | ||
| 49 | % (a,b) = (0,0) is the lower-left corner of the paper | ||
| 50 | % (c,d) is the coordinate of the upper-right corner of the figure relative to the lower-left corner of the figure | ||
| 51 | % Therefore, c>=a, d>=b | ||
| 52 | % Full paper position would be [0,0,8.5,11] in inches | ||
