Documentation Center

  • Trial Software
  • Product Updates

clone

Create copy of existing circuit element or circuit object

Syntax

Description

example

outelem = clone(inelem) creates a circuit element, outelem, with identical properties as inelem. The clone does not copy information about the parent circuit such as ParentNodes and ParentPath.

example

outckt = clone(inckt) creates a circuit object, outckt, identical to inckt. Circuit elements in the inckt are cloned recursively and added to the same nodes in the outckt. The ports or terminals in the outckt are defined same as inckt.

Examples

Create an Element and Clone It

Create a resistor element and clone it.

hRclone1 = resistor(50);
hRclone2 = clone(hRclone1);
disp (hRclone1)
disp (hRclone2)
 resistor: Resistor element

    Resistance: 50
          Name: 'R'
     Terminals: {'p'  'n'}

  resistor: Resistor element

    Resistance: 50
          Name: 'R'
     Terminals: {'p'  'n'}

Create an Circuit and Clone it

Create a circuit object. Add a resistor and capacitor to it. Clone the circuit object.

hcktclone1 = circuit('circuit1');
hCclone1= add(hcktclone1,[1 2],capacitor(3e-9));
hRclone1 = add(hcktclone1,[2 3],resistor(100));
hcktclone2 = clone(hcktclone1);
disp(hcktclone1)
disp (hcktclone2)
  circuit: Circuit element

    ElementNames: {'C'  'R'}
           Nodes: [1 2 3]
            Name: 'circuit1'

  circuit: Circuit element

    ElementNames: {'C'  'R'}
           Nodes: [1 2 3]
            Name: 'circuit1'

Input Arguments

expand all

inelem — Circuit elementscalar handle object

Circuit element to be cloned, specified as scalar handle object. The circuit element can be a resistor, capacitor, or inductor.

inckt — Circuit objectscalar handle object

Circuit object to be cloned, specified as scalar handle object.

Output Arguments

expand all

outelem — Circuit elementscalar handle object

Cloned circuit element, returned as scalar handle object. The circuit element can be a resistor, capacitor, or inductor.

outckt — Circuit objectscalar handle object

Cloned circuit object, returned as scalar handle object.

See Also

| | |

Was this topic helpful?