How do I process dates information from Spotfire variables and tables into Matlab data functions?. Converting dates from Spotfire to Matlab.

I have a variable declared as date type in Spotfire M/D/Y (5/30/2016) passed to a Matlab data function via a Document Property Control. The function includes commands like:

TenorsMonthMat  = StartDatePeriodVar + calmonths(1:12);
EndMonth = month(TenorsMonthMat(1,12));
EndYear = year(TenorsMonthMat(1,12));

I get the error:

Could not execute function call.
TIBCO Spotfire Statistics Services returned an error: 'Undefined function 'month' for input arguments of type 'calendarDuration'.'.
   at Spotfire.Dxp.Data.DataFunctions.Executors.RemoteFunctionClient.OnExecuting(FunctionClient funcClient)
   at Spotfire.Dxp.Data.DataFunctions.Executors.AbstractFunctionClient.<RunFunction>d__0.MoveNext()
   at Spotfire.Dxp.Data.DataFunctions.Executors.SPlusFunctionExecutor.<ExecuteFunction>d__0.MoveNext()
   at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__6.MoveNext()

 

I think it's because Matlab cannot process dates from Spotfire as is with Matlab standard date related commands since when date or time values are sent into MATLAB, they are converted to double values (whose integer part is the number of days since 1/1/1960, and whose fractional part is the fraction of the day), see:

https://docs.tibco.com/pub/sf_statsvcs/7.5.0/doc/html/TIB_sf_statsvcs_7....

What commands should I apply in Matlab to do an appropriate conversion?.

I wonder if I can leverage the Matlab command:

T = datetime(X,'ConvertFrom', 'epochtime','Epoch','1960-01-01') where X is a numeric value and datetime whould return the number of days since 1/1/1960, see

http://www.mathworks.com/help/matlab/ref/datetime.html

 

(2) Answers

Login