Search code examples
c#ilnumerics

How to Access correctly to Positions Property in a LinePlot with Ilnumerics?


i would like to access to the coordinate information in a LinePlot, i wanto to use the Property LinePlot.Positions as show in the following code:

using System;
using System.Collections.Generic;
using System.Text;
using ILNumerics.Data;
using ILNumerics.Drawing.Plotting;
using ILNumerics.Drawing;
using ILNumerics;
using static ILNumerics.ILMath;
using System.Linq;

namespace TestConsoleUI2
{
    class Program
    {
        static void Main(string[] args)

         {
            Array<double> xx = linspace(10, 15, 5);
            Array<double> yy = linspace(8, 90, 5);

            LinePlot myLinePlot = new LinePlot(xx, yy);

            RetArray<float> p = myLinePlot.Positions;

          }
    }
}

Nevertheless i got an System.NullReferenceException i have debugged and the data exists at that moment, can anyone help me?

Regards


Solution

  • After try and error i found the solution that is working for me.

    using System;
    using System.Collections.Generic;
    using System.Text;
    using ILNumerics.Data;
    using ILNumerics.Drawing.Plotting;
    using ILNumerics.Drawing;
    using ILNumerics;
    using static ILNumerics.ILMath;
    using System.Linq;
    
    namespace TestConsoleUI2
    {
        class Program
        {
            static void Main(string[] args)
    
             {
                Array<double> xx = linspace(10, 15, 5);
                Array<double> yy = linspace(8, 90, 5);
    
                LinePlot myLinePlot = new LinePlot(xx, yy);
    
                PositionsBuffer p = myLinePlot.Line.Positions;
    
              }
        }
    }