Element-wise multiplication for timetables
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
With elimination of fints, how can we do element-wise multiplication (.*) for two timetables?
Thank you!
0 Kommentare
Antworten (1)
Steven Lord
am 27 Mär. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!