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.

Matlab function

Please login with a confirmed email address before reporting spam

I want to use matlab function in COMSOL. I try to plot the my matlab funtion in comsol, i got an error meesage Incorrect size of returned vector. 247 elements were expected, but the returned matrix was 1 x 1

please me to resolve tthis issue.

with regards, Kiran


1 Reply Last Post 2018年7月3日 GMT-4 07:28
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 2018年7月3日 GMT-4 07:28

When using Matlab function from Comsol we send a number of values to Matlab in batches since communication with Matlab is slow.

This means that all inputs to your functions are vectors of the same size. You must make sure that your function returns a vector of exactly the same as the inputs.

This is covered in great detail in the LiveLink for Matlab User's Guide and the Vacuum Flask model that comes with the Model Library.

-------------------
Lars Gregersen
Comsol Denmark
When using Matlab function from Comsol we send a number of values to Matlab in batches since communication with Matlab is slow. This means that all inputs to your functions are vectors of the same size. You must make sure that your function returns a vector of exactly the same as the inputs. This is covered in great detail in the LiveLink for Matlab User's Guide and the Vacuum Flask model that comes with the Model Library.

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.