Easy way to divide a field in a struct by a number?
11 次查看(过去 30 天)
显示 更早的评论
Hello All,
I have a 5394 x 1 struct with 2 fields labeled "cluster" and "spx_time". I'd like to divide all values in the "spx_time" field by 1000. Is there an easier way to do this other than by using a for loop?
Thanks!
0 个评论
采纳的回答
Image Analyst
2018-7-16
If you want to extract them into a double variable you can avoid a for loop (though one might be done internally with []):
new_spx_times = [s.spx_time] / 1000;
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!