代码拉取完成,页面将自动刷新
capture program drop nwrecode
program nwrecode
version 9
syntax anything(name=arg) [, into(string) generate(string) prefix(string) *]
if "`arg'" == "" {
exit
}
if "`into'" != "" {
local generate "`into'"
}
local ruleStart = strpos("`arg'", "(")
local netname = substr("`arg'",1, `=`ruleStart'-1')
local rules = substr("`arg'",`ruleStart',.)
_nwsyntax_other `netname', max(9999)
preserve
tokenize `generate'
local i = 1
foreach onenet in `othernetname' {
_nwsyntax `onenet'
local onedirected `directed'
nwtoedge `onenet', forcedirected
recode `onenet' `rules', `options'
qui nwfromedge _fromid _toid `onenet', name(__temp_network)
nwtomata __temp_network, mat(recodeNet)
if "`generate'" == "" & "`prefix'" == "" {
nwreplacemat `onenet', newmat(recodeNet)
}
else {
if "`prefix'" != "" {
nwduplicate `onenet', name(`prefix'`onenet')
nwreplacemat `prefix'`onenet', newmat(recodeNet)
}
if "`generate'" != "" {
if "``i''" != "" {
nwduplicate `onenet', name(``i'')
nwreplacemat ``i'', newmat(recodeNet)
}
else {
nwreplacemat `onenet', newmat(recodeNet)
}
}
}
capture nwdrop __temp_network
mata: mata drop recodeNet
local i = `i' + 1
nwname `onenet', newdirected(`onedirected')
}
restore
end
*! v1.5.0 __ 17 Sep 2015 __ 13:09:53
*! v1.5.1 __ 17 Sep 2015 __ 14:54:23
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。