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

Assigning materials to domains from MATLAB

$
0
0
Dear COMSOL experts,

I am wondering how to assign materials to domains from a matlab script. For example, I create a block "my_block" with

>> model.geom('geom1').feature.create('my_block', 'Block');
>> ... % define the properties of block here

Then I create a material called "superconductor" with

>> model.material.create('superconductor');

Now, if I assign the "my_block" to material "superconductor" through COMSOL GUI and save the result as m file, the assignment will look like this:

>> model.material('superconductor').selection.set([1]);

How do I find out programatically the correspondence between "my_block" and the number 1 that I need to specify as the parameter to the last command.

Thanks in advance,
Andrey

Viewing all articles
Browse latest Browse all 428

Trending Articles



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