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 string representing the filename 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 strings 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 string that 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 String specification for fprintf.

The freqformat string that specifies the precision of the frequency. The default value is %-22.10f. See the Format String 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

The following example shows you how to analyze the data stored in the file default.s2p for a different set of frequency values, and use the write method to store the results in a file called test.s2p.

orig_data=read(rfdata.data,'default.s2p')
freq=[1:.1:2]*1e9;
analyze(orig_data,freq);
write(orig_data,'test.s2p');

References

EIA/IBIS Open Forum, "Touchstone File Format Specification," Rev. 1.1, 2002 (http://www.vhdl.org/pub/ibis/connector/touchstone_spec11.pdf).

Was this topic helpful?