Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: return null Mata

From   "Thomas, Anthony" <[email protected]>
To   [email protected]
Subject   st: return null Mata
Date   Tue, 1 Apr 2014 16:41:01 -0400

Hi All,

I'm sure there is an obvious answer to this question, but I can't seem
to figure it out. I have a Mata function that I want to return nothing
when some condition fails to be met (the function is ordinarily
supposed to return a string matrix). I was thinking something like:

if(something) return(NULL);

or if(something) return(0);

would work, but I get errors indicating the return type is not as
expected in either case. I'm guessing this is because NULL is really a
pointer and 0 is just being interpreted in its normal sense. How can I
get Mata to return nothing in one instance and a string matrix in


*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index