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