Multiplying structure array with a scaler
13 次查看(过去 30 天)
显示 更早的评论
I have Data.mat file that is a 1x365 structure array and i would like to multiply all the values of the 4th column by 2 and store them in to a variable.
采纳的回答
Matt J
2021-3-22
If you mean you want to multiply all the fields by 2,
s0.a=1;s0.b=2;s0.c=3 %example struct
s=structfun(@(f)2*f, s0,'uni',0)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!