📄 mf_valofexternal.hlp
字号:
{smcl}
{* 23mar2005}{...}
{cmd:help mata valofexternal()}
{hline}
{* index valofexternal()}{...}
{* index externals}{...}
{* index global variable}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] valofexternal() -- Obtain value of external global}
{title:Syntax}
{p 8 12 2}
{it:transmorphic matrix}
{cmd:valofexternal(}{it:string scalar name}{cmd:)}
{title:Description}
{p 4 4 2}
{cmd:valofexternal(}{it:name}{cmd:)} returns the contents of the
external global matrix, vector, or scalar whose name is specified by
{it:name}; it returns J(0,0,.) if the external global is not found.
{p 4 4 2}
Also see {it:Linking to external globals} in
{bf:{help m2_declarations:[M-2] declarations}}.
{title:Remarks}
{p 4 4 2}
Also see {bf:{help mf_findexternal:[M-5] findexternal()}}. Rather than
returning a pointer to the external global, as does {cmd:findexternal()},
{cmd:valofexternal()} returns the contents of the external global. This
is useful when the external global contains a scalar:
{cmd:tol = valofexternal("tolerance")}
{cmd:if (tol==J(0,0,.)) tol = 1e-6}
{p 4 4 2}
Using {cmd:findexternal()}, one alternative would be
{cmd}if ((p = findexternal("tolerance"))==NULL) tol = 1e-6
else tol = *p{txt}
{p 4 4 2}
For efficiency reasons, use of {cmd:valofexternal()} should be avoided
with nonscalar objects; see {bf:{help mf_findexternal:[M-5] findexternal()}}.
{title:Conformability}
{cmd:valofexternal(}{it:name}{cmd:)}:
{it:name}: 1 {it:x} 1
{it:result}: {it:r x c} or 0 {it:x} 0 if not found
{title:Diagnostics}
{p 4 4 2}
{cmd:valofexternal()} aborts with error if {it:name} contains an invalid name.
{p 4 4 2}
{cmd:valofexternal(}{it:name}{cmd:)} returns J(0,0,.) if {it:name} does not
exist.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] valofexternal()}
{p 4 13 2}
Online: help for
{bf:{help mf_findexternal:[M-5] findexternal()}};
{bf:{help m4_programming:[M-4] programming}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -