changeset 358:5cb99f56f55e

Added some utility functions. Improved some documentation.
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 05 Dec 2016 13:31:57 +0100
parents f18142c1530b
children 0e198af1184b 4a5d83324ec1 8c8fd649bae3 0976e579a6f0
files +grid/place_label.m spyh.m stripeMatrix.m timeTask.m
diffstat 4 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
diff -r f18142c1530b -r 5cb99f56f55e +grid/place_label.m
--- a/+grid/place_label.m	Thu Oct 13 09:34:42 2016 +0200
+++ b/+grid/place_label.m	Mon Dec 05 13:31:57 2016 +0100
@@ -1,3 +1,5 @@
+% 'left' | 'center' | 'right'
+% 'baseline' | 'top' | 'cap' | 'middle' | 'bottom'
 function place_label(pt,str,horzAl,vertAl)
     default_arg('horzAl','center');
     default_arg('vertAl', 'middle');
diff -r f18142c1530b -r 5cb99f56f55e spyh.m
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/spyh.m	Mon Dec 05 13:31:57 2016 +0100
@@ -0,0 +1,16 @@
+% spyh mimics the built in spy but returns a handle which allows modifying the plot.
+function h = spyh(A)
+    [n,m] = size(A);
+    [I,J] = find(A);
+
+    h = plot(J,I);
+    h.LineStyle = 'none';
+    h.Marker = '.';
+    h.MarkerSize = 14;
+
+    a = gca;
+    xlim([0 m+1]);
+    ylim([0 n+1]);
+    axis square
+    a.YDir = 'reverse';
+end
\ No newline at end of file
diff -r f18142c1530b -r 5cb99f56f55e stripeMatrix.m
--- a/stripeMatrix.m	Thu Oct 13 09:34:42 2016 +0200
+++ b/stripeMatrix.m	Mon Dec 05 13:31:57 2016 +0100
@@ -1,4 +1,5 @@
 % Creates a matrix of size n,m with the values of val on the diagonals diag.
+%   A = stripeMatrix(val,diags,n,m)
 function A = stripeMatrix(val,diags,n,m)
     default_arg('m',n);
 
diff -r f18142c1530b -r 5cb99f56f55e timeTask.m
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/timeTask.m	Mon Dec 05 13:31:57 2016 +0100
@@ -0,0 +1,9 @@
+function done = timeTask(taskName)
+    fprintf('%s', taskName);
+    tStart = tic;
+
+    function done_fun()
+        fprintf(' - done %fs\n', toc(tStart));
+    end
+    done = @done_fun;
+end
\ No newline at end of file