Main Content

write

Write RF data from circuit or data object to file

Description

status = write(data,filename,dataformat,funit,printformat,freqformat) writes information from data to the specified file. The write function returns True if the operation is successful and returns False otherwise.

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.

example

Examples

collapse all

Read the data stored in the file default.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'

Analyze the data stored in the specified file for a set of frequency values.

freq = [1:.1:2]*1e9;
analyze(orig_data,freq);

Use the write function to store the results in a file called test.s2p.

write(orig_data,'test.s2p')
ans = logical
   1

Input Arguments

collapse all

Object that contains sufficient information to write the specified files, specified as an RF circuit or data object.

File name of a .snp, .ynp, .znp, .hnp, or .amp file extensions, where n is the number of ports, specified as a character vector, or string scalar.

Data format to be written, specified as a character vector or string scalar. It must be one of the case-insensitive values specified 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).

Frequency units of the data, specified in 'GHz', 'MHz', 'KHz', or 'Hz'.

Note

If you do not specify funit, its value is taken from the object data. All values are case-insensitive

Represents precision of the network and noise parameters, specified using formatting operators. For example, if you set the printformat to %22.10f, this means that the method writes the data using fixed-point notation with a precision of 10 digits. The minimum positive value that the write function can express by default is 1e-10. For greater precision, specify a different printformat. See the formatspec argument in the fprintf function for more information.

Represents precision of the frequency, specified using formatting operators. See fprintf for more information.

References

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

Version History

Introduced before R2006a