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 LiveLink
Posted Jan 5, 2017, 12:14 p.m. EST Interfacing Version 5.2a 1 Reply
Please login with a confirmed email address before reporting spam
Hey there,
I am using LiveLink MATLAB but when running my model, the notice "Undefined function or variable 'mphopen'" is emerged on the command window. However, I have set up the file "domain_activation_llmatlab" in the MATLAB path. could it be some problem related to LiveLinke? How could I find it that my COMSOL 5.2a can LiveLink to the MATLAM R2016a.
this is one of the comsol's sample problems (www.comsol.com/model/domain-activation-and-deactivation-12060). I, however, cannot do this. what do you suggest. the MATLAB code is as follows:
------------------
model = mphopen('domain_activation_llmatlab');
domInd = [2,3,5,4];
ht = model.physics('ht');
for i = 1:8
k = mod(i,4);
if k == 0
k = 4;
end
ht.selection.set([1 domInd(k)]);
ht.feature('init2').selection.set(domInd(k));
model.study('std1').run;
if i==1
cpt1 = model.result.dataset.create('cpt1', 'CutPoint3D');
cpt1.set('pointx', '0 L/2 L');
cpt1.set('pointy', '0 L/2 L');
cpt1.set('pointz', 'L/10');
pg1 = model.result.create('pg1', 'PlotGroup1D');
pg1.set('data', 'cpt1');
ptgr1 = pg1.feature.create('ptgr1', 'PointGraph');
ptgr1.set('legend', 'on');
pg2 = model.result.create('pg2', 'PlotGroup3D');
surf1 = pg2.feature.create('surf1', 'Surface');
surf1.set('rangecoloractive', 'on');
surf1.set('rangecolormax', '336');
surf1.set('rangecolormin', '293.15');
ht.feature('init1').set('T', 1, 'T');
v1 = model.sol('sol1').feature('v1');
v1.set('initsol', 'sol1');
end
figure(1)
mphplot(model,'pg1','rangenum',1)
hold on
figure(2)
subplot(4,2,i)
pg2.setIndex('looplevel','25',0);
mphplot(model,'pg2');
time = mphglobal(model,'t','solnum','end');
model.param.set('t0',time);
disp(sprintf('End of iteration No.%d',i));
end
----------------------
I am using LiveLink MATLAB but when running my model, the notice "Undefined function or variable 'mphopen'" is emerged on the command window. However, I have set up the file "domain_activation_llmatlab" in the MATLAB path. could it be some problem related to LiveLinke? How could I find it that my COMSOL 5.2a can LiveLink to the MATLAM R2016a.
this is one of the comsol's sample problems (www.comsol.com/model/domain-activation-and-deactivation-12060). I, however, cannot do this. what do you suggest. the MATLAB code is as follows:
------------------
model = mphopen('domain_activation_llmatlab');
domInd = [2,3,5,4];
ht = model.physics('ht');
for i = 1:8
k = mod(i,4);
if k == 0
k = 4;
end
ht.selection.set([1 domInd(k)]);
ht.feature('init2').selection.set(domInd(k));
model.study('std1').run;
if i==1
cpt1 = model.result.dataset.create('cpt1', 'CutPoint3D');
cpt1.set('pointx', '0 L/2 L');
cpt1.set('pointy', '0 L/2 L');
cpt1.set('pointz', 'L/10');
pg1 = model.result.create('pg1', 'PlotGroup1D');
pg1.set('data', 'cpt1');
ptgr1 = pg1.feature.create('ptgr1', 'PointGraph');
ptgr1.set('legend', 'on');
pg2 = model.result.create('pg2', 'PlotGroup3D');
surf1 = pg2.feature.create('surf1', 'Surface');
surf1.set('rangecoloractive', 'on');
surf1.set('rangecolormax', '336');
surf1.set('rangecolormin', '293.15');
ht.feature('init1').set('T', 1, 'T');
v1 = model.sol('sol1').feature('v1');
v1.set('initsol', 'sol1');
end
figure(1)
mphplot(model,'pg1','rangenum',1)
hold on
figure(2)
subplot(4,2,i)
pg2.setIndex('looplevel','25',0);
mphplot(model,'pg2');
time = mphglobal(model,'t','solnum','end');
model.param.set('t0',time);
disp(sprintf('End of iteration No.%d',i));
end
----------------------
1 Reply Last Post Jan 12, 2017, 9:12 a.m. EST