annotate assert_size.m @ 86:3c39dd714fb6
In Curve: Added numerical FD differentiation if derivative is not supplied. Added arc length computation based on the derivative. Added arc length parameterization (but this function is very slow.). In +util: Added fzero_vec.m and integral_vec.m, which call fzero and integral but take vector arguments.
author |
Martin Almquist <martin.almquist@it.uu.se> |
date |
Sun, 29 Nov 2015 14:28:53 +0100 |
parents |
48b6fb693025 |
children |
afd20f023928 |
rev |
line source |
0
|
1 % Assert that array A has the size s.
|
|
2 function assert_size(A,s)
|
|
3 errmsg = sprintf('Expected %s to have size %s, got: %s',inputname(1), format_vector(s), format_vector(size(A)));
|
|
4 assert(all(size(A) == s),errmsg);
|
|
5 end
|
|
6
|
|
7 function str = format_vector(a)
|
|
8 l = length(a);
|
|
9 str = sprintf('[%d',a(1));
|
|
10
|
|
11 for i = 2:l
|
|
12 str = [str sprintf(', %d',a(i))];
|
|
13 end
|
|
14
|
|
15 str = [str ']'];
|
|
16 end |