File: get_connected.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (27 lines) | stat: -rw-r--r-- 953 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function connected=get_connected(scs_m,k,typ)
//return the vector of number of link connected to a given block
//   scs_m      :   structure of blocks and links
//   k          :   block_number
//   typ        :   'in','out','clkin','clkout'
//   connected  :   vector of connected link numbers
// Copyright INRIA
[lhs,rhs]=argn(0)
o=scs_m(k)
graphics=o(2)
[ip,op,cip,cop]=graphics(5:8)
connected=[]
if rhs<=2 then // all connected links
  if ip<>[] then connected=[connected ip(find(ip>0))'],end
  if op<>[] then connected=[connected op(find(op>0))'],end
  if cip<>[] then connected=[connected cip(find(cip>0))'],end
  if cop<>[] then connected=[connected cop(find(cop>0))'],end
else
  if typ=='in' then connected=[connected ip(find(ip>0))'],end
  if typ=='out' then connected=[connected op(find(op>0))'],end
  if typ=='clkin' then connected=[connected cip(find(cip>0))'],end
  if typ=='clkout' then connected=[connected cop(find(cop>0))'],end
end