I have a comsol model. I want to draw a few plots for different values of a global parameter called plot_z, e.g. if plot_z can have 5 different values I want to draw 5 different plots, one for each value. In each plot I need to write the value of plot_z parameter in the plot title. I have typed many expressions such as plot_z, $plot_z, %plot_z%, etc. in the plot title text box, but unfortunately none of them worked.

Is it even possible to have the value of a global parameter in plot title?

  • $\begingroup$ Hi Mehrdad, and welcome to scicomp! Have you tried asking this question on the official COMSOL forum? comsol.com/community $\endgroup$
    – Paul
    Dec 20 '12 at 5:03
  • $\begingroup$ Hi @Paul, well, I am from Iran and as a result of american sanctions against Iran they have suspended my account! $\endgroup$
    – Mehrdad
    Dec 20 '12 at 15:03
  • $\begingroup$ I suspect the answer depends on the version of COMSOL you are working with (since the interaction with Matlab - where such a thing would be easy - changed over time). $\endgroup$ Dec 20 '12 at 16:11
  • $\begingroup$ I have comsol 4.2. so, Christian, you mean that I need to use matlab for doing this? matlab livelink? $\endgroup$
    – Mehrdad
    Dec 21 '12 at 6:49

In this scenario I would suggest to use matlab livelink. I'm not aware of how to include these global parameters in the comsol figures without loading it into MATLAB. If you do opt to do it in MATLAB, you could use the following code.:
title(['Your Title',num2str(plot_z)])
You may also need to change your code to address the different parameters, maybe using a for loop.


Not the answer you're looking for? Browse other questions tagged or ask your own question.