Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

New Post: engine.Evaluate in an event driven method

$
0
0
evolvedmicrobe's comment had me go back to the drawing board and start with a fresh console app to test some ideas. This works as expected:
                engine.Initialize();
                var e = engine.Evaluate("a<-0");
                NumericVector v1 = engine.GetSymbol("a").AsNumeric();
                Console.WriteLine("a = "+ v1[0].ToString());
                for (int i = 0; i < 10; i++)
                {
                    engine.Evaluate("a <- a + 1");
                    NumericVector v2 = engine.GetSymbol("a").AsNumeric();
                    Console.WriteLine("a + 1 = " + v2[0].ToString());
                    
                }
                Console.WriteLine("Press any key to exit");
                Console.ReadKey();
... and by playing around with variable scope and declaration I can recreate the exceptions I saw yesterday ( C# null refs and R.NET parse exceptions). I'll take this knowledge and now go back to the initial project and try to fix it. Thanks for the hand holding!

Viewing all articles
Browse latest Browse all 1634

Trending Articles