I have a simple SKILL script that I load and run in the CIW window after an ADE-L simulation finishes to output a sampled waveform to a text file for Matlab post processing. A simplified example follows:
writePort = outfile("f1.txt")
for( i 0 Num_pts-1
tx = i*t_clk
this_t = t_start + tx
v1 = value(VT("/v1node") this_t)
fprintf(writePort "%10.6g " v1)
The problem is when I try this after running a corner sweep in ADE-XL I get "srrWave:0x51f13e70" type of data. I assume the voltage is now a structured array, with multiple waveforms (one per corner), and I need to use a function to access each corner data waveform separately. What is the easiest way to do this?
I have played with ocnPrint() which does indeed work. However, it also outputs column data with corner information spread throughout the numerical data in the file. This makes the file bigger and requires more text processing (e.g., slower) in Matlab. I was wondering if there was another solution closer in nature to my original script.
Many thanks in advance for any tips!
A much simpler solution would be to use the Spectre Toolbox for Matlab (run <MMSIMinstRoot>/bin/cdnshelp and search for "matlab toolbox"). This would allow you to use the cds_srr function directly within Matlab to read the PSF data directly (at the root of the PSF results for the entire ADE XL run) and avoid any text processing at all. You'll then get Matlab multi-dimensional data indexed by the sweep variables.
You could look at abDumpWaveforms or abDumpFamily in the code in this post or abDumpWaveformsToVCSV in the code in this post. One potential problem with abDumpWaveforms is that the x-axis of all the time-domain waveforms may not be consistent (unless maybe you used the strobeperiod option to ensure they are regularly spaced time steps in the output); I think that will make it a bit more challenging for abDumpWaveformsToVCSV although it can handle it OK if my memory is OK (I think each curve ends up with a separate x-axis in the CSV file). The abDumpFamily writes each family member into a separate file (if my memory is correct) so that might be an option too. Anyway, a few to try out - I referenced these in an earlier post asking about using Matlab on Windows when the result data is on UNIX.