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.

Misfunctioning of importData method in Livelink.

Please login with a confirmed email address before reporting spam

Dear all,

I would like to ask you the following. I am facing problems in using the importData method in Livelink.

More precisely, using Livelink, in Matlab I am able to read a model, create inside Matbal a interpolation function over the mesh of a set of data and save the interpolation function in the Comsol Model. When it's time to import the data, the problem comes out. In fact, these are the lines to define the properties of my interpolating function:

model.func('value').set('nargs', '3');
model.func('value').set('defvars', true);
model.func('value').set('source', 'file');
model.func('value').set('filename', '/amd/smana3/root/vol/vol1/cmcs/tricerri/Comsol/MatlabScripts/associatedData.txt');
model.func('value').set('interp','linear');
model.func('value').set('sourcetype','user');

Then to import the data, if I use the model.func(tag).importData() command (as suggested in the guide) when I open the model (that has been modified in Matlab) in Comsol I am not able to plot the interpolating function. If I just define the filename and then, just import the file using Comsol (therefore I remove the importData command from Matlab) then, I can plot the interpolating function.

I have not found any guide about importData. Do you know how to use it? What am I missing?

Many thanks,

Paolo Tricerri

1 Reply Last Post 26 set 2012, 10:02 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 26 set 2012, 10:02 GMT-4
Hi Paolo,

Maybe you can try this:

model.func.remove('int1');
model.func.create('int1', 'Interpolation');
model.func('int1').set('source', 'file');
model.func('int1').set('filename', Input_filename);
model.func('int1').importData;
model.sol('sol1').run;

importData works only when "Input_filename" is the full path : 'C:\Users\you\Desktop\...\xxx.csv'

Good luck.

--
L. Queval
Hi Paolo, Maybe you can try this: model.func.remove('int1'); model.func.create('int1', 'Interpolation'); model.func('int1').set('source', 'file'); model.func('int1').set('filename', Input_filename); model.func('int1').importData; model.sol('sol1').run; importData works only when "Input_filename" is the full path : 'C:\Users\you\Desktop\...\xxx.csv' Good luck. -- L. Queval

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.