Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

COMSOL programming

Please login with a confirmed email address before reporting spam

Hello, I want to generate random interpolation curve coordinate (xyz) using comsol program and my code follows

model.component(“comp1”).geom(“geom1”).create(“ic1”, “InterpolationCurve”); with(model.component(“comp1”).geom(“geom1”).feature(“ic1”)); int N = 100; double KK[][] = new double[N][3]; for (int k = 1; k < 100; k++) { KK[k][0] = Math.random(); KK[k][1] = Math.random); KK[k][2] = Math.random(); set("table", new double[][]{{KK[k][0], KK[k][1], KK[k][2]}}); } endwith();

table reads only (100th) last coordinate but I want all coordinates(100) in table. please help me.

Thanks Kiran


2 Replies Last Post 2020年11月18日 GMT-5 23:19
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 4 years ago 2020年11月18日 GMT-5 02:16

I haven't tested it but I think this line will work:

set("table", KK);

and you want to put it outside your loop, but before endwith()

-------------------
Lars Gregersen
Comsol Denmark
I haven't tested it but I think this line will work: set("table", KK); and you want to put it outside your loop, but before endwith()

Please login with a confirmed email address before reporting spam

Posted: 4 years ago 2020年11月18日 GMT-5 23:19

Hi Lars, Thanks for your reply. No, I does not work for me. I need to import the new XYZ coordinate for each iterlation from excel. so that I can generate new interpolation curve. Please do needful one.

Thanks Kiran

Hi Lars, Thanks for your reply. No, I does not work for me. I need to import the new XYZ coordinate for each iterlation from excel. so that I can generate new interpolation curve. Please do needful one. Thanks Kiran

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.