Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

Export animation/image sequence via Matlab Livelink

Please login with a confirmed email address before reporting spam

Hi,

I'm have a HT problem which I solve time dependently via the Matlab Livelink. Since I have a lot of models to solve this way, I would like to export the image sequence of the solution automatically to e.g. pic1.png, pic2.png, ...,picx.png.

I have created the following m-code, however it does NOT produce any warning/error, NOR it produces my wanted .png files:
(plotgroup2 is set-up properly)
model.result.export.create('anim1', 'Animation');
model.result.export('anim1').set('plotgroup', 'pg2');
model.result.export('anim1').set('type', 'imageseq');
model.result.export('anim1').set('sweeptype', 'solutions');
model.result.export('anim1').set('imagefilename', 'C:\files\pic.png');
model.result('pg2').set('window', 'graphics');
model.result('pg2').set('windowtitle', 'Plot of HT');
model.result('pg2').run;
model.result.export('anim1').run;

If I open my .mph file afterwards and click the export button, everything works fine and my files are created, but somehow the Livelink won't produce the images.

Who knows why this is?


Regards,

Peter.


10 Replies Last Post 2012年9月20日 GMT-4 02:11

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年4月15日 GMT-4 08:14
Hi Peter,

I have a similar problem.
I also create some plot groups with Matlab scripts.
Sometimes this works, sometimes this does not work (although the code is always the same, very strange).
Sometimes the script stops with an "unsatisfied link" java error message, when running model.result('pg8').run
Would be nice to know the reason for this strange behavior.

Anyways, when the script manages to pass this critical point and later should create an animation from this plot group in the same way you try it in your code, the script crashes, when it wants to run:
model.result.export('anim1').run

This error message appears (whatever it means).

This does not help you, but now we are two ;-)
Maybe someone experienced the same and found a solution for that.

Have a nice weekend,
Juergen







??? Java exception occurred:
Exception:
java.lang.RuntimeException: java.io.InvalidClassException: com.comsol.util.classes.FlStringList;
local class incompatible: stream classdesc serialVersionUID = -7563983620598702692, local class
serialVersionUID = 3136439966478934778
(rethrown as com.comsol.util.exceptions.FlException)
Messages:
java.io.InvalidClassException: com.comsol.util.classes.FlStringList; local class incompatible:
stream classdesc serialVersionUID = -7563983620598702692, local class serialVersionUID =
3136439966478934778

Stack trace:
at org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFactoryImpl.java:621)
at com.comsol.clientserver.impl.ClientserverFactoryImpl.createThrowableFromString(Unknown Source)
at com.comsol.clientserver.impl.ClientserverFactoryImpl.createFromString(Unknown Source)
at org.eclipse.emf.ecore.util.EcoreUtil.createFromString(EcoreUtil.java:3257)
at org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl$25.convertToEMF(CDOTypeImpl.java:601)
at org.eclipse.emf.internal.cdo.CDOStore.convertToEMF(CDOStore.java:396)
at org.eclipse.emf.internal.cdo.CDOStore.get(CDOStore.java:171)
at org.eclipse.emf.internal.cdo.CDOObjectImpl.dynamicGet(CDOObjectImpl.java:485)
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleData.dynamicGet(EStructuralFeatureImpl.java:1959)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1029)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1013)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1005)
at com.comsol.clientserver.impl.JobImpl.getException(Unknown Source)
at com.comsol.model.clientserver.ClientManagerImpl.a(Unknown Source)
at com.comsol.model.clientserver.ClientManagerImpl.runServerJob(Unknown Source)
at com.comsol.model.impl.ExportFeatureImpl$a.a(Unknown Source)
at com.comsol.model.impl.ExportFeatureImpl$a.execute(Unknown Source)
at com.comsol.model.clientserver.ClientManagerImpl$d.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.InvalidClassException: com.comsol.util.classes.FlStringList; local class incompatible:
stream classdesc serialVersionUID = -7563983620598702692, local class serialVersionUID =
3136439966478934778
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFactoryImpl.java:617)
... 22 more
Hi Peter, I have a similar problem. I also create some plot groups with Matlab scripts. Sometimes this works, sometimes this does not work (although the code is always the same, very strange). Sometimes the script stops with an "unsatisfied link" java error message, when running model.result('pg8').run Would be nice to know the reason for this strange behavior. Anyways, when the script manages to pass this critical point and later should create an animation from this plot group in the same way you try it in your code, the script crashes, when it wants to run: model.result.export('anim1').run This error message appears (whatever it means). This does not help you, but now we are two ;-) Maybe someone experienced the same and found a solution for that. Have a nice weekend, Juergen ??? Java exception occurred: Exception: java.lang.RuntimeException: java.io.InvalidClassException: com.comsol.util.classes.FlStringList; local class incompatible: stream classdesc serialVersionUID = -7563983620598702692, local class serialVersionUID = 3136439966478934778 (rethrown as com.comsol.util.exceptions.FlException) Messages: java.io.InvalidClassException: com.comsol.util.classes.FlStringList; local class incompatible: stream classdesc serialVersionUID = -7563983620598702692, local class serialVersionUID = 3136439966478934778 Stack trace: at org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFactoryImpl.java:621) at com.comsol.clientserver.impl.ClientserverFactoryImpl.createThrowableFromString(Unknown Source) at com.comsol.clientserver.impl.ClientserverFactoryImpl.createFromString(Unknown Source) at org.eclipse.emf.ecore.util.EcoreUtil.createFromString(EcoreUtil.java:3257) at org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl$25.convertToEMF(CDOTypeImpl.java:601) at org.eclipse.emf.internal.cdo.CDOStore.convertToEMF(CDOStore.java:396) at org.eclipse.emf.internal.cdo.CDOStore.get(CDOStore.java:171) at org.eclipse.emf.internal.cdo.CDOObjectImpl.dynamicGet(CDOObjectImpl.java:485) at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleData.dynamicGet(EStructuralFeatureImpl.java:1959) at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1029) at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1013) at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1005) at com.comsol.clientserver.impl.JobImpl.getException(Unknown Source) at com.comsol.model.clientserver.ClientManagerImpl.a(Unknown Source) at com.comsol.model.clientserver.ClientManagerImpl.runServerJob(Unknown Source) at com.comsol.model.impl.ExportFeatureImpl$a.a(Unknown Source) at com.comsol.model.impl.ExportFeatureImpl$a.execute(Unknown Source) at com.comsol.model.clientserver.ClientManagerImpl$d.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.InvalidClassException: com.comsol.util.classes.FlStringList; local class incompatible: stream classdesc serialVersionUID = -7563983620598702692, local class serialVersionUID = 3136439966478934778 at java.io.ObjectStreamClass.initNonProxy(Unknown Source) at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source) at java.io.ObjectInputStream.readClassDesc(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFactoryImpl.java:617) ... 22 more

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年4月18日 GMT-4 11:14
Yes, I am still stuck at this problem and I would still be very happy if I knew what goes wrong here! :)
Yes, I am still stuck at this problem and I would still be very happy if I knew what goes wrong here! :)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年5月16日 GMT-4 09:21
Did you find a solution or work around in the meantime?
I would be still interested in the reason for that error/bug
Did you find a solution or work around in the meantime? I would be still interested in the reason for that error/bug

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年5月17日 GMT-4 09:27
I'm sorry that I have to say that I haven't. I'm not working on it anymore aswell.

Good luck!
I'm sorry that I have to say that I haven't. I'm not working on it anymore aswell. Good luck!

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年6月28日 GMT-4 13:37
Hi,

Did you find any solution for this problem? I´m facing the exactly same problem.

Please let me know if you solved it. If not, we should talk to support about that, right?

Thanks in advance,
Andre
Hi, Did you find any solution for this problem? I´m facing the exactly same problem. Please let me know if you solved it. If not, we should talk to support about that, right? Thanks in advance, Andre

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年6月30日 GMT-4 05:12
I agree that this kind of problems should be solved.
However, I am not working on the problem anymore. Moreover, at this moment I don't even have access to COMSOL. My work at the company has finished.

I'm sorry.

However, you can try support for sure.


Regards,

Peter.
I agree that this kind of problems should be solved. However, I am not working on the problem anymore. Moreover, at this moment I don't even have access to COMSOL. My work at the company has finished. I'm sorry. However, you can try support for sure. Regards, Peter.

Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年7月1日 GMT-4 06:42
Hi

You are always welcome to send bug reports to Comsol support.

In this case I think the problem is caused by the following: In order to Comsol to generate any graphics output when using the LiveLink for Matlab you need to start the Comsol Server with the -graphics option.


Lars Gregersen
Comsol Denmark
Hi You are always welcome to send bug reports to Comsol support. In this case I think the problem is caused by the following: In order to Comsol to generate any graphics output when using the LiveLink for Matlab you need to start the Comsol Server with the -graphics option. Lars Gregersen Comsol Denmark

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年3月3日 GMT-5 02:15
I have some question with the plotgroup export under matlab livelink.
I want to export a field distribution picture and I have added -graphics option to start comsol server.

first, on a machine with integrate graphic card (dell optiplex), the script lost comsolserver at plotgroup.run();
so what's the requirement on the graphic card? why?

second, on another machine I can run the same script, this machine is dell INSPIRE ONE 2320, it is slow for family use.

what I really wanted is to write pngfile without display. So how to write the matlab script? see below. I comment the run line

model.result.create('pg1', 'PlotGroup2D');
model.result('pg1').name('field');
model.result('pg1').feature.create('surf1', 'Surface');
%model.result('pg1').run; %%%%

model.result.export.create('img1', 'Image2D');
model.result.export('img1').set('plotgroup', 'pg1');
model.result.export('img1').set('title', 'on'); %%%%
model.result.export('img1').set('pngfilename', ['11.png']);
%model.result.export('img1').run; %%%%

third, how to add the default title on the export pngfile, I have check the Java API manual. a property in "title" is
string with default empty. on comsol Desktop if the title option is unchecked, a default title is add which is special and easy to distinguish. How to restore this feature under matlab script?

Thanks.











I have some question with the plotgroup export under matlab livelink. I want to export a field distribution picture and I have added -graphics option to start comsol server. first, on a machine with integrate graphic card (dell optiplex), the script lost comsolserver at plotgroup.run(); so what's the requirement on the graphic card? why? second, on another machine I can run the same script, this machine is dell INSPIRE ONE 2320, it is slow for family use. what I really wanted is to write pngfile without display. So how to write the matlab script? see below. I comment the run line model.result.create('pg1', 'PlotGroup2D'); model.result('pg1').name('field'); model.result('pg1').feature.create('surf1', 'Surface'); %model.result('pg1').run; %%%% model.result.export.create('img1', 'Image2D'); model.result.export('img1').set('plotgroup', 'pg1'); model.result.export('img1').set('title', 'on'); %%%% model.result.export('img1').set('pngfilename', ['11.png']); %model.result.export('img1').run; %%%% third, how to add the default title on the export pngfile, I have check the Java API manual. a property in "title" is string with default empty. on comsol Desktop if the title option is unchecked, a default title is add which is special and easy to distinguish. How to restore this feature under matlab script? Thanks.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年9月19日 GMT-4 20:17
How do you start the comsol server with the -graphics option?

How do you start the comsol server with the -graphics option?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年9月20日 GMT-4 02:11
Dear Sean,

you can start comsol in server mode with "comsolserver -graphics" from a command line.
Then you can start Matlab and use the following lines of code in your .m file:

% path to the mli-Folder, in my case it is:
addpath 'C:\Program Files\COMSOL\COMSOL43\mli'
import com.comsol.model.*
import com.comsol.model.util.*
mphstart

if you log in to the server remotely, sometimes the "-graphics" option might cause error messages and problems related to rendering problems. Switch to software rendering instead, when you start the comsol server in graphics mode. Try "comsolserver -3drend sw -graphics"

Hope this helps,
Juergen

Dear Sean, you can start comsol in server mode with "comsolserver -graphics" from a command line. Then you can start Matlab and use the following lines of code in your .m file: % path to the mli-Folder, in my case it is: addpath 'C:\Program Files\COMSOL\COMSOL43\mli' import com.comsol.model.* import com.comsol.model.util.* mphstart if you log in to the server remotely, sometimes the "-graphics" option might cause error messages and problems related to rendering problems. Switch to software rendering instead, when you start the comsol server in graphics mode. Try "comsolserver -3drend sw -graphics" Hope this helps, Juergen

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.