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.

Solved! Good in comsol, failed in Matlab: Illegal input vector illegal entity number

Please login with a confirmed email address before reporting spam

Hello every body, I am using comsol 5.4 and I built my model and solved the problem and everything went fine and a good solution was obtained in comsol. Exporting the same exact model to matlab is problematic! Exactly the same model and when running this model in matlab I got the following error:

Error using file (line 912)

Java exception occurred:

Exception:

com.comsol.util.exceptions.UnexpectedServerException: java.lang.IllegalArgumentException: Illegal input vector illegal entity number (rethrown as com.comsol.util.exceptions.FlException)

Messages:

java.lang.IllegalArgumentException: Illegal input vector illegal entity number

Stack trace:

at com.comsol.model.selections.GeomObjectSelectionMethod.a(SourceFile:1465)

at com.comsol.model.selections.GeomObjectSelectionMethod.a(SourceFile:1382)

at com.comsol.model.selections.GeomObjectSelectionMethod.set(SourceFile:806)

at com.comsol.model.selections.GeomObjectSelectionMethod.set(SourceFile:791)

at com.comsol.model.data.primitive.GeomObjectSelectionPrim.set(SourceFile:334)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at com.comsol.bridge.command.b.a(SourceFile:145)

at com.comsol.bridge.command.b.run(SourceFile:90)

at com.comsol.bridge.command.i.execute(SourceFile:45)

at com.comsol.bridge.command.j.d(SourceFile:711)

at com.comsol.bridge.command.j.a(SourceFile:699)

at com.comsol.bridge.command.j$3.a(SourceFile:600)

at com.comsol.bridge.command.j$3.call(SourceFile:1)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

and the corresponding line is a selection set line :

model.component('comp1').geom('geom1').feature('del1').selection('input').set({'par3(12)' 'par3(7)' 'par3(4)' 'par3(2)' 'par3(5)' 'par3(11)' 'par3(6)' 'par3(9)' 'par3(10)' 'par3(8)' ... 'par3(3)' 'par3(1)'}, [1 2 3 4 5 6 7; 1 2 3 0 0 0 0; 1 2 3 0 0 0 0; 1 2 3 4 0 0 0; 1 2 3 4 0 0 0; 1 2 3 4 0 0 0; 1 2 3 4 0 0 0; 1 2 3 0 0 0 0; 1 2 3 0 0 0 0; 1 2 3 0 0 0 0; 1 2 3 4 0 0 0; 1 2 3 4 5 6 7]);

what's the problem with matlab?? thanks!


2 Replies Last Post 10 gen 2019, 04:53 GMT-5
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 10 gen 2019, 02:53 GMT-5
Updated: 6 years ago 10 gen 2019, 03:20 GMT-5

Hi Bell

It is hard to tell what goes wrong without having access to your model. What version of Comsol did you use to generate the offending line?

If you are able to share your model then please send the MPH-file to support and we will have a look.

The problem is with jagged arrays, which are allowed in Java, but not in Matlab. The solution is to split the settings into separate statements (perhaps if you do "File->Compact History" Comsol will do this for you). Something like this: model.component('comp1').geom('geom1').feature('del1').selection('input').set('par3(12)', [1 2 3 4 5 6 7]) model.component('comp1').geom('geom1').feature('del1').selection('input').set('par3(7)', [1 2 3])

etc.

should work.

-------------------
Lars Gregersen
Comsol Denmark
Hi Bell It is hard to tell what goes wrong without having access to your model. What version of Comsol did you use to generate the offending line? If you are able to share your model then please send the MPH-file to support and we will have a look. The problem is with jagged arrays, which are allowed in Java, but not in Matlab. The solution is to split the settings into separate statements (perhaps if you do "File->Compact History" Comsol will do this for you). Something like this: model.component('comp1').geom('geom1').feature('del1').selection('input').set('par3(12)', [1 2 3 4 5 6 7]) model.component('comp1').geom('geom1').feature('del1').selection('input').set('par3(7)', [1 2 3]) etc. should work.

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 10 gen 2019, 04:53 GMT-5

You're just brilliant! It worked.

You're just brilliant! It worked.

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.