Given two input structures (s1, s2), determine which field values have been modified in s2 compared to s1. Your output should be a cell array of appropriate fieldnames and a cell array of the corresponding s2 field values. If s1 and s2 are identical (i.e. no values have been changed), return [] for both outputs.
Example
Suppose
s1.foo = 1; s1.bar = 2; s1.baz = 3;
and
s2.foo = 1; s2.bar = 0; s2.baz = 3;
then the correct output is
f = {'bar'}
v = {0}
Assumptions
- Inputs are scalar structures
- Inputs have identical fieldnames
- Field values can be numeric arrays, strings, or cell arrays
- The ith cell in output f corresponds to the ith cell in output v
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers23
Suggested Problems
-
Select every other element of a vector
36293 Solvers
-
Replace NaNs with the number that appears to its left in the row.
3064 Solvers
-
given 3 sides, find area of this triangle
820 Solvers
-
Arrange Vector in descending order
13335 Solvers
-
286 Solvers
More from this Author43
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!