compareStruct compares Structs fields and returns logical 1 (true) if the input structs have the same fields, and logical 0 (false) otherwise, no matter their content.
Hey Jos(10584), sorry for the delay in notice that the code had not been updated!
Just send version 2 reviewed in February!
Something seems amiss. I do not see any code changes, Marco.
Thanks for the suggestions. Were accepted and the code remade.
The code can be replaced by a one-liner:
B = isequal(sort(fieldnames(a)), sort(fieldnames(b)))
I do like the fact that you have written a clear help section, including a H1 line. As for your code, as soon as B becomes false in the for-loop you can issue a return command (no need to check the remaining field names).
You also might want to check if the input are indeed structures.
v2 : Changes compare struct like Jos (10584) mention
Changes suggested by the user Jos (10584) accepted!
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.