c# - Ilnumerics Ilpanel not activating when compiled in a winform into a dll when loaded into matlab -
i want compile winform written in c# in visual-studio 2012 dll load matlab 2013a. using matlab .net interface want interact winform, listening events , passing data via set of predefined public methods. working on windows 7 ultimate sp2.
this works surprisingly well, able interact native winform tools, buttons, trees, panels , charts. want use ilnumerics , particularly ilpanel used display "scenes" containing wonder of things. hit brick wall nothing ever gets rendered in ipanel when compiled dll , called matlab. ever shows default oval.
i can attach matlab process in visual studio , run through code. executes fine. looks scene on line 32 not attached ilpanel1.
any appreciated.
form1.cs primary c# code without form1.designer.cs
using system; using system.windows.forms; using ilnumerics; using ilnumerics.drawing.plotting; using ilnumerics.drawing; using markerstyle = ilnumerics.drawing.markerstyle; namespace windowsformsapplication3 { public partial class form1 : form { public form1() { initializecomponent(); } public void plotdata(double[,] myx) { var mydoublevec = new double[myx.length]; (int = 0; < myx.length; i++) { mydoublevec[i] = myx[i, 0]; } var scene = new ilscene(); ilarray<double> mynumx = mydoublevec; scene.add(new ilplotcube { new illineplot(ilmath.tosingle(mynumx.t), markerstyle: markerstyle.dot) }); ilpanel1.scene = scene; } private void ilpanel1_load_1(object sender, eventargs e) { var mydouble = new double[,] { { 2 }, { 4 }, {9 }, { 16 } }; ; plotdata(mydouble); } public void plotrandom() { double yvalue = 50.0; double yvalue2 = 200.0; if (chart1.series["series1"].points.count > 0) { yvalue = chart1.series["series1"].points[chart1.series["series1"].points.count - 1].yvalues[0]; yvalue2 = chart1.series["series2"].points[chart1.series["series1"].points.count - 1].yvalues[0]; } random random = new random(); (int pointindex = 0; pointindex < 50; pointindex++) { yvalue = yvalue + (float)(random.nextdouble() * 10.0 - 5.0); chart1.series["series1"].points.addy(yvalue); yvalue2 = yvalue2 + (float)(random.nextdouble() * 10.0 - 5.0); chart1.series["series2"].points.addy(yvalue2); } } private void button1_click(object sender, eventargs e) { plotrandom(); } private void button2_click(object sender, eventargs e) { var mydouble = new double[,] { { 2 }, { 4 }, { 6 }, { 8 } }; ; plotdata(mydouble); } } }
the resulting winform looks follows.
matlab code load assembly , manipulate form.
net.addassembly('c:\users\philliproso\documents\visual studio 2012\projects\windowsformsapplication3\windowsformsapplication3\bin\debug\windowsformsapplication3.dll') myform=windowsformsapplication3.form1; myform.show; myform.plotrandom; %this call works fine myform.plotdata(rand(50,1)); %this call has no effect
Comments
Post a Comment