[I Fnames Istruct] = CompStruct(S1,S2,[TOL])
Function to compare the content of 2 structures with identical fields. Returns a vector of 1's and zeros indicating the fields where the contents are equal. Returns NaN if structures do not have identical fields. I = [IsClose(S1.(Fnames{1}),S2.(Fnames{1}),TOL), ... IsClose(S1.(Fnames{end}),S2.(Fnames{end}),TOL)]
Parameters |
Description |
S1 [struct] |
First structure to be compared. |
S2 [struct] |
Second structure to be compared |
TOL [scalar] |
(Optional) Tolerance for comparing numerical values. Defaults to eps. |
Return Values |
Description |
I [logical vector] |
Indicates fields where components are equal. Returns NaN if structures do not have identical fields. If field is a structure, returns true if the structures are identical, regardless of TOL. |
Fnames [cell array] |
Field names corresponding to the order of comparison in the output logical vector I. Always the order of the fields in the first input structure. Returns the set of fieldnames that are not in both inputs if the inputs do not have identical fields. |
Istruct [logical vector] |
True if the field is a structure. |
Copyright (c) 2009. All rights reserved.
|
What do you think about this topic? Send feedback!
|