Borrar filtros
Borrar filtros

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

11 visualizaciones (últimos 30 días)
PAK
PAK el 16 de Jul. de 2018
Respondida: Image Analyst el 16 de Jul. de 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!

Respuesta aceptada

Image Analyst
Image Analyst el 16 de Jul. de 2018
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;

Más respuestas (0)

Categorías

Más información sobre Data Type Identification en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by