write

Write RF data from circuit or data object to file

Syntax

status = write(data,filename,dataformat,funit,printformat, 
freqformat)

Description

status = write(data,filename,dataformat,funit,printformat,freqformat) writes information from data to the specified file. data is a circuit object or rfdata.data object that contains sufficient information to write the specified file. filename is a character vector representing the file name of a .snp, .ynp, .znp, .hnp, or .amp file, where n is the number of ports. The default filename extension is .snp. write returns True if the operation is successful and returns False otherwise.

dataformat specifies the format of the data to be written. It must be one of the case-insensitive values in the following table.

Format

Description

'DB'

Data is given in (dB-magnitude, angle) pairs with angle in degrees.

'MA'

Data is given in (magnitude, angle) pairs with angle in degrees.

'RI'

Data is given in (real, imaginary) pairs (default).

funit specifies the frequency units of the data to be written. It must be 'GHz', 'MHz', 'KHz', or 'Hz'. If you do not specify funit, its value is taken from the object data. All values are case-insensitive.

The printformat specifies the precision of the network and noise parameters. The default value is %22.10f. This value means the method writes the data using fixed-point notation with a precision of 10 digits. The minimum positive value the write method can express by default is 1e-10. For greater precision, specify a different printformat. See the Format specification for fprintf.

The freqformat specifies the precision of the frequency. The default value is %-22.10f. See the Format specification for fprintf.

Note

The method only writes property values from data that the specified output file supports. For example, Touchstone files, which have the .snp, .ynp, .znp, or .hnp extension, do not support noise figure or output third-order intercept point. Consequently, the write method does not write these property values to these such files.

Examples

collapse all

Analyze the data stored in the file default.s2p for a set of frequency values. Use the write method to store the results in a file called test.s2p.

orig_data=read(rfdata.data,'default.s2p')
orig_data = 
   rfdata.data with properties:

            Freq: [191x1 double]
    S_Parameters: [2x2x191 double]
      GroupDelay: [191x1 double]
              NF: [191x1 double]
            OIP3: [191x1 double]
              Z0: 50.0000 + 0.0000i
              ZS: 50.0000 + 0.0000i
              ZL: 50.0000 + 0.0000i
        IntpType: 'Linear'
            Name: 'Data object'

freq = [1:.1:2]*1e9;
analyze(orig_data,freq);
write(orig_data,'test.s2p')
ans = logical
   1

References

EIA/IBIS Open Forum, “Touchstone File Format Specification,” Rev. 1.1, 2002 (https://ibis.org/connector/touchstone_spec11.pdf).

Introduced before R2006a