how can I test for the existence of a financial time series object?

15 visualizaciones (últimos 30 días)
Michael
Michael el 23 de Jul. de 2014
Respondida: Sean de Wolski el 23 de Jul. de 2014
This seems like it would be really easy, but I can't figure it out.
Basically, i want to see if time series A exists, and if it does, I want to make C=merge(A,B). If A doesn't exist, then I just want C=B.
Thanks for any help.
Best, Mike

Respuestas (2)

dpb
dpb el 23 de Jul. de 2014
doc exist
if exist('A')
C=merge(A,B);
else
C=B
end
I don't have Finan Toolbox so can't test; I presume exist will return 8 as a class if it does exist. Of course, any nonzero value means there is an A of some sort extant as the logic above is written it doesn't care which type of object it may be.

Sean de Wolski
Sean de Wolski el 23 de Jul. de 2014
isa and exist will be your friends.
if exist('A','var') && isa(A,'timeseries')
C = merge(A,B)
else
C = B;
end

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by