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

2 ビュー (過去 30 日間)
Scotty Neally
Scotty Neally 2022 年 6 月 2 日
回答済み: Scotty Neally 2022 年 6 月 3 日
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 Center および File ExchangeVisualization 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