Mercurial > repos > public > sbplib
comparison structIsSubset.m @ 22:30b6e72db1a3
Moved structIsSubset to it's own file.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 23 Sep 2015 09:43:53 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
21:b1e04c1f2b45 | 22:30b6e72db1a3 |
---|---|
1 % Returns true if the the fields of struct a exists in A and have the same values | |
2 function b = structIsSubset(a,A) | |
3 fn = fieldnames(a); | |
4 | |
5 b = true; % if a has no filds | |
6 for j = 1:length(fn) | |
7 fname = fn{j}; | |
8 value = a.(fname); | |
9 if isfield(A,fname) && a.(fname) == A.(fname) | |
10 b = true; | |
11 continue; | |
12 else | |
13 b = false; | |
14 break; | |
15 end | |
16 end | |
17 end |