Please login with a confirmed email address before reporting spam
Hi
Calling MATLAB functions by the Comsol solvers only allow one output.
You need to split your functions into two. Alternatively you can do something like this
functions y=mytest(x,idx)
[y1,y2] = test(x);
if idx==1
y = y1;
else
y = y2;
end
If your function is very expensive to calculate then you'll have to cache the result of the calculaitons.
PS. Note that using "test" as a function name in Comsol will probably cause problems for your model.
Thank you Lars Gregersen for your answer, regarding the name of the function I just use "test" as an example.
functions y=mytest(x,idx)
[y1,y2] = test(x); if idx==1 y = y1; else y = y2;
end
In your proposal, I can only use one variable in comsol y1 or y2. I need both variables at the same time to start the calculation.
Best regards
>Hi
>
>Calling MATLAB functions by the Comsol solvers only allow one output.
>
>You need to split your functions into two. Alternatively you can do something like this
>
>functions y=mytest(x,idx)
>
>[y1,y2] = test(x);
>if idx==1
>y = y1;
>else
>y = y2;
>end
>
>If your function is very expensive to calculate then you'll have to cache the result of the calculaitons.
>
>PS. Note that using "test" as a function name in Comsol will probably cause problems for your model.
Thank you Lars Gregersen for your answer, regarding the name of the function I just use "test" as an example.
functions y=mytest(x,idx)
[y1,y2] = test(x); if idx==1 y = y1; else y = y2;
end
In your proposal, I can only use one variable in comsol y1 or y2. I need both variables at the same time to start the calculation.
Best regards