Model 2651A High Power System SourceMeter® Instrument User's Manual  Section 6: Characterization of power discretes 
--[[
   PrintIVcurveData(gsteps, dsteps)
 
   Description:   This function will output the data collected by the
   IV_Curves() function in a Microsoft Excel compatible format. For each
   step of the gate, this function will output three columns that contain
   the drain sweep data and the gate data in the first row.
   Parameters:
      gsteps:   The number of steps in the gate sweep
      dsteps:   The number of steps in the drain sweep
   Example Usage:
      PrintIVcurveData(5, 21)
--]]
function PrintIVcurveData(gsteps, dsteps)
   line1 = ""
   line2 = ""
   for i = 1,gsteps do
      line1 = line1 .. string.format("Vgs = %0.2f\t%g\t%g\t",
         node[2].smua.nvbuffer1.sourcevalues[i], node[2].smua.nvbuffer2[i],
         node[2].smua.nvbuffer1[i])
      line2 = line2 .. "Source Value\tVoltage\tCurrent\t"
   end
   print(line1)
   print(line2)
   for i = 1, dsteps do
      line = ""
      for j = 1, gsteps do
         line = line .. string.format("%g\t%g\t%g\t",
            smua.nvbuffer1.sourcevalues[(j - 1) * dsteps + i],
            smua.nvbuffer2[(j - 1) * dsteps + i],
            smua.nvbuffer1[(j - 1) * dsteps + i])
      end
      print(line)
   end
end
 
 
2651A-900-01 Rev. A / March 2011  6-15