How can I decide one struct to another one?
2 views (last 30 days)
Show older comments
Kiryl Zhaliazka
on 22 Mar 2022
Commented: Kiryl Zhaliazka
on 29 Mar 2022
I have struct s1 96 fields, each field contein 1 number, and the same struct s2 but with another numbers in fields. How can i create an array tat contein s1/s2 ? Thank you
0 Comments
Accepted Answer
Matt J
on 22 Mar 2022
Edited: Matt J
on 23 Mar 2022
%structfun(@(a,b) a./b, s1,s2,'uni',0)
%EDIT:
s3=s1;
for fld=fieldnames(s1)'
fld=fld{1};
s3.(fld)=s1.(fld)/s2.(fld);
end
More Answers (0)
See Also
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!