public void SetupMeasurement()
 {
     if (this.online)
     {
         if (calFile != "")
         {
             application.Recall(calFile);
             //guid = calSet.GetGUID;
             //channel = application.ActiveChannel;
             channel = application.Channel(2); //make the argument 1 for S11, 2 for S21, or whatever the calset says
             //channel.SelectCalSet(guid, true);
         }
         else
         {
             channel = application.Channel(2); //default channel when no calset selected
             //channel.application.ActiveChannel;
             channel.StartFrequency = startFreq;
             channel.StopFrequency  = stopFreq;
             channel.NumberOfPoints = points;
             channel.IFBandwidth    = ifbw; //decreasing IF bandwidth has effect similar to avg'g but takes longer __ I disagree
             //channel.StartPower = -80; //increasing port power doesnt really help
             //channel.StopPower = -80; //increasing port power doesnt really help
         }
         //application.CreateMeasurement(1, type.ToString(), 1, 1); //type.ToString is e.g. "S21" - whatever selected by user
         application.CreateMeasurement(2, type.ToString(), 1, 1); //make the first argument 1 for S11, 2 for S21, or whatever the calset says
         measurement = (IArrayTransfer)application.ActiveMeasurement;
     }
 }
        public void SetupMeasurement()
        {
            channel = application.Channel(2); //default channel when no calset (update: calset has been removed by me) selected
            channel.StartFrequency = startFreq;
            channel.StopFrequency  = stopFreq;
            channel.NumberOfPoints = points;
            channel.IFBandwidth    = ifbw;                           //decreasing IF bandwidth has effect similar to avg'g but takes longer __ I disagree

            application.CreateMeasurement(2, type.ToString(), 1, 1); //make the first argument 1 for S11, 2 for S21, or whatever the calset says


            // UPDATE 15/4: fixing format changing, make it work
            IMeasurement measurementSet = application.ActiveMeasurement;

            measurementSet.Format = (NADataFormat)format;

            measurement = (IArrayTransfer)measurementSet;
        }