How to import corrupted s-parameter (touchstone) file up to X Ghz?

2 次查看(过去 30 天)
I have a large touchstone 1.0 file that got corrupted during save when PC ran out of memory. The file in question is ~5GB but I routinely work with ~15GB files (s384p) with many frequency points. Because it is not easy to open the file and chop off corrupted data after X frequency (because DC -> X are still valid), how can I do a frequency span selectable read using the RF toolbox "sparameters" function? Is there an alternative way to edit this large of a txt file in-line to remove corrupted (incomplete) frequency points? Recall touchstone stores frequency data for all points sequentially, so chopping off data after X frequency should not hurt the integrity of the remaining file.

采纳的回答

Scotty Neally
Scotty Neally 2022-6-3
Psuedo-code (faster with git bash installed):
  • fopen() toucshtone for read, fseek() to end of file (eof).
  • fseek() backwards and appropriate amount (as determined by number of ports) to before last frequency point.
  • Read line-by-line, and use regexp test to find valid frequency as first entry.
  • Record start of chop point (before valid frequency entry) using ftell()
  • Run git bash split (matlab dos execution), cleanup unneccesary files, & rename corrected file
  • or use fprintf() to rewrite a new touchstone file (can be time intensive for large files)
Usage:
ClipLastFreq(filename,0) or ClipLastFreq(filename) %for git bash split
ClipLastFreq(filename,1) %for matlab fprintf()

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Visualization and Data Export 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by