comparison assert_size.m @ 797:5cf9fdf4c98f feature/poroelastic

Merge with feature/grids and bugfix bcSetup
author Martin Almquist <malmquist@stanford.edu>
date Thu, 26 Jul 2018 10:53:05 -0700
parents afd20f023928
children
comparison
equal deleted inserted replaced
796:aa1ed37a1b56 797:5cf9fdf4c98f
1 % Assert that array A has the size s. 1 % Assert that array A has the size s.
2 function assert_size(A,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))); 3 warning('Use assertSize() instead!')
4 assert(all(size(A) == s),errmsg); 4 assertSize(A,s);
5 end 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