Element-wise multiplication for timetables
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
With elimination of fints, how can we do element-wise multiplication (.*) for two timetables?
Thank you!
0 comentarios
Respuestas (1)
Steven Lord
el 27 de Mzo. de 2019
A timetable can contain many different types of data, some of which define element-wise multiplication and some of which don't. The easiest way to perform arithmetic on a specific numeric variable in a timetable is to index into the timetable.
thedates = datetime('today')+days(0:5);
TT = array2timetable(magic(6), 'RowTimes', thedates)
y = TT.Var3 .* TT.Var5
If you want to perform the same operation on all numeric variables in your timetable you can do that using vartype.
y2 = TT{:, vartype('double')}.^2
TT{:, vartype('double')} = y2
If the data stored in the timetable can be concatenated into a numeric array, you could reference all of it at once.
TT.Variables = sqrt(TT.Variables)
0 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!