MATLAB Answers

PAK
0

Easy way to divide a field in a struct by a number?

Asked by PAK
on 16 Jul 2018
Latest activity Answered by Image Analyst
on 16 Jul 2018
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 Comments

Sign in to comment.

Tags

Products


Release

R2016a

1 Answer

Answer by Image Analyst
on 16 Jul 2018
 Accepted Answer

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 Comments

Sign in to comment.