Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 5773

Create interpolation function using LiveLink with Matlab

$
0
0

Hi everyone,

I would like to create a user-defined interpolation function using LiveLink with Matlab.

Here is what I do (in Matlab):

model.component('comp1').func.create(int2, 'Interpolation'); model.component('comp1').func(int2).set('funcname','my_func'); model.component('comp1').func(int2).label('my_func_label'); model.component('comp1').func(int2).set('argunit', 's'); model.component('comp1').func(int2).set('fununit', 'Pa');

I know there are three methods to feed data to the interpolation function: Result table, file and local table. I would prefer to use the local table, so I do, which is very tedious:

model.component('comp1').func(int2).setIndex('table', t1, 1, 0); model.component('comp1').func(int2).setIndex('table', value1, 1, 1); model.component('comp1').func(int2).setIndex('table', t2, 2, 0); model.component('comp1').func(int2).setIndex('table', value2, 2, 1); model.component('comp1').func(int2).setIndex('table', t3, 3, 0); model.component('comp1').func(int2).setIndex('table', value3, 3, 1); ... ... The question: Is there a way to write the entire 2D-array or 2x1 vectors to the table? Since I need to do this for many interpolation functions (on the order of 100s) and for every time step in the simulation (on the order of 1000s), there will be a lot of resulting calls. Alternatively, I guess I could first write the data to files, but then I would have to create 100s of files first to read from.

Any help and suggestions would be appreciated,

Theo


Viewing all articles
Browse latest Browse all 5773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>