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 with matlab how to express "if An object with the given name already exists" in Matlab

Please login with a confirmed email address before reporting spam

Dear somebody who concern, I use COMSOL with matlab to change some parameters to achieve optimization and simulation, but some parameters will make an object(in fact, it is formmesh) disappear, and some parameters will not. Therefore, I need to know how to express "if An object with the given name already exists" in Matlab, to control my optimization and simulation. The error it told me was bellow:

Java exception occurred: 
Exception:
com.comsol.util.exceptions.FlException: An object with the given name already exists
Messages: 已存在指定名称的对象。
- 标记: deform1

Stack trace:
at com.comsol.model.method.ModelEntityListMethod.checkContains(SourceFile:291)
at com.comsol.model.dbmodel.ModelEntityListDb.checkContains(SourceFile:379)
at com.comsol.model.dbmodel.GeomListDb.doCreate(SourceFile:71)
at com.comsol.model.util.DeformedConfigUtil.createDeformedGeom(SourceFile:44)
at com.comsol.post.dataset.bd.a(SourceFile:531)
at com.comsol.post.dataset.ap.createDeformedConfig(SourceFile:591)
at com.comsol.model.method.DatasetFeatureMethod.createDeformedConfig(SourceFile:215)
at com.comsol.model.dbmodel.DatasetFeatureDb.createDeformedConfig(SourceFile:147)
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)

Thank you very much!


0 Replies Last Post 03.04.2020, 11:45 GMT-4
COMSOL Moderator

Hello David Wang

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

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.