Jeff Hiller
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
7 years ago
Apr 26, 2018, 8:52 a.m. EDT
Updated:
7 years ago
Apr 26, 2018, 10:08 a.m. EDT
Hi John,
After you do 3/ , you can right-click in the model tree node for the Line Graph in question and select Add Plot Data to Export from the drop-down menu. You will be asked to specify a file name for the file will be exported. You also have the option to get the data exported to the clipboard instead of to a file.
Best,
Jeff
[Edit: my last sentence is true of version 5.3a, but not of 4.4.]
-------------------
Jeff Hiller
Hi John,
After you do 3/ , you can right-click in the model tree node for the Line Graph in question and select Add Plot Data to Export from the drop-down menu. You will be asked to specify a file name for the file will be exported. You also have the option to get the data exported to the clipboard instead of to a file.
Best,
Jeff
[Edit: my last sentence is true of version 5.3a, but not of 4.4.]
Please login with a confirmed email address before reporting spam
Posted:
7 years ago
Apr 26, 2018, 10:03 a.m. EDT
Jeff,
Nice to hear from you, thank you for the response! I should have posted with my question that this is for a MATLAB livelink API application. So, what I am looking for is a way to obtain this data via the API w/o the need to pop up a plot from COMSOL first. I have focused on trying to figure this out via the COMSOL UI first and then save the file as an ".m" file to see what API calls are involved.
Do you know a way to obtain this data via the API?
Best regards,
John
Jeff,
Nice to hear from you, thank you for the response! I should have posted with my question that this is for a MATLAB livelink API application. So, what I am looking for is a way to obtain this data via the API w/o the need to pop up a plot from COMSOL first. I have focused on trying to figure this out via the COMSOL UI first and then save the file as an ".m" file to see what API calls are involved.
Do you know a way to obtain this data via the API?
Best regards,
John
Jeff Hiller
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
7 years ago
Apr 26, 2018, 10:11 a.m. EDT
Sorry, John, but I don't have MATLAB to test this out and I don't know off hands (especially regarding 4.4). I would recommend you contact support@comsol.com . I am sure they know the answer.
Jeff
-------------------
Jeff Hiller
Sorry, John, but I don't have MATLAB to test this out and I don't know off hands (especially regarding 4.4). I would recommend you contact support@comsol.com . I am sure they know the answer.
Jeff
Please login with a confirmed email address before reporting spam
Posted:
7 years ago
Apr 26, 2018, 10:25 a.m. EDT
Thank you, Jeff, I appreciate the help!
Best regards,
John
Thank you, Jeff, I appreciate the help!
Best regards,
John
Gunnar Andersson
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
7 years ago
Apr 27, 2018, 2:33 a.m. EDT
If you have a plot, then you can retrieve the plot data using the API. I suggest that you try the following for a line graph containing one single line:
x = plot.getVertices(0, 0);
y = plot.getData(0, 0, "Height");
I don't have access to MATLAB, but these API calls work in Java, and I don't see any reason why they wouldn't work from MATLAB.
If you have a plot, then you can retrieve the plot data using the API. I suggest that you try the following for a line graph containing one single line:
x = plot.getVertices(0, 0);
y = plot.getData(0, 0, "Height");
I don't have access to MATLAB, but these API calls work in Java, and I don't see any reason why they wouldn't work from MATLAB.
Please login with a confirmed email address before reporting spam
Posted:
7 years ago
Apr 27, 2018, 12:06 p.m. EDT
Thank you, Gunnar.
Here's what I'm using to extract the temperature along a line selection (“boundaryline”) in the model at time 100.0 sec from dataset “dset1”. This is making COMSOL 4.4 API calls from MATLAB.
model.result().numerical().create('tempResult','Eval');
model.result().numerical('tempResult').set('expr','T');
model.result().numerical('tempResult').set('t','100.0');
model.result().numerical('tempResult').set('data','dset1');
model.result().numerical('tempResult').selection.named('boundaryline');
yvalue = model.result().numerical('tempResult').getData();
xvalue = model.result().numerical('tempResult').getCoordinates();
This seems to work, but I welcome feedback if something doesn't look right. Thanks!
John
Thank you, Gunnar.
Here's what I'm using to extract the temperature along a line selection (“boundaryline”) in the model at time 100.0 sec from dataset “dset1”. This is making COMSOL 4.4 API calls from MATLAB.
model.result().numerical().create('tempResult','Eval');
model.result().numerical('tempResult').set('expr','T');
model.result().numerical('tempResult').set('t','100.0');
model.result().numerical('tempResult').set('data','dset1');
model.result().numerical('tempResult').selection.named('boundaryline');
yvalue = model.result().numerical('tempResult').getData();
xvalue = model.result().numerical('tempResult').getCoordinates();
This seems to work, but I welcome feedback if something doesn't look right. Thanks!
John