Mercurial > repos > public > sbplib
comparison +blockmatrix/isDivision.m @ 427:a613960a157b feature/quantumTriangles
merged with feature/beams
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Thu, 26 Jan 2017 15:59:25 +0100 |
parents | 764438b52541 |
children | a5f1b0267dba |
comparison
equal
deleted
inserted
replaced
426:29944ea7674b | 427:a613960a157b |
---|---|
1 function b = isDivision(div) | |
2 % Make sure it is a cellarray | |
3 if ~iscell(div) | |
4 b = false; | |
5 return | |
6 end | |
7 | |
8 % Make sure it has the right shape | |
9 if numel(div) ~= 2 | |
10 b = false; | |
11 return | |
12 end | |
13 | |
14 if ~isDivisionVector(div{1}) || ~isDivisionVector(div{2}) | |
15 b = false; | |
16 return | |
17 end | |
18 | |
19 b = true; | |
20 end | |
21 | |
22 function b = isDivisionVector(v) | |
23 if isempty(v) | |
24 b = false; | |
25 return | |
26 end | |
27 | |
28 if any(v <= 0) | |
29 b = false; | |
30 return | |
31 end | |
32 | |
33 b = true; | |
34 end |