From 6307d40d118ff28beae8772d0a1dbb15a734252a Mon Sep 17 00:00:00 2001 From: Kevin Shan Date: Wed, 19 Jun 2019 18:06:35 -0700 Subject: [PATCH] Cast weight vector to same datatype as spikes Previously, attachData() did not check that the weight vector `w` was the same datatype as the given spikes `Y`, which could cause an error when performing model operations later. This was particularly annoying when accepting the default value of `w`. This commit makes attachData() automatically cast `w` to the same datatype as `Y`. --- @MoDT/attachData.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/@MoDT/attachData.m b/@MoDT/attachData.m index 72a9ce1..32e4916 100644 --- a/@MoDT/attachData.m +++ b/@MoDT/attachData.m @@ -59,6 +59,9 @@ function attachData(self, Y_, t_, varargin) assert(ismember(datatype_,{'single','double'}), self.badValueErrId, ... 'Datatype must be single- or double-precision floating point'); +% Cast w to the same datatype as Y +w_ = cast(w_, datatype_); + % (2) Assign values ------------------------------------------------------------ % Clear caches