This is somewhat of a stylistic choice. "For example" should use commas except when it would make the sentence harder to read.
- While it is common practice to do recalibration between trials, for example in reading research, this is not always possible or feasible.
While it is common practice to do recalibration between trials, for example in reading research, this is not always possible or feasible.
While it is common practice to do recalibration between trials, for example, in reading research, this is not always possible or feasible.
- While it is common practice to do recalibration between trials, for example, in reading research, this is not always possible or feasible.
In my opinion, option (1) is easier to read with the entire "for example" contained by one pair of commas. But, stylistically, my opinion is that the following would be even more appropriate:
While it is common practice to do recalibration between trials (for example, in reading research) this is not always possible or feasible.
This satisfies the traditional pattern of using commas after "for example" but still keeps the clause separated from the main sentence.
Your second example is, again, somewhat of a stylistic choice but the guidance of using a comma does not drastically impede the readability of the sentence.
- While it is common practice to do recalibration between trials, this is not always possible or feasible (for example in studies where task completion time is measured or where an interruption might impact on contextual information or the participant’s thought processes).
While it is common practice to do recalibration between trials, this is not always possible or feasible (for example in studies where task completion time is measured or where an interruption might impact on contextual information or the participant’s thought processes).
While it is common practice to do recalibration between trials, this is not always possible or feasible (for example, in studies where task completion time is measured or where an interruption might impact on contextual information or the participant’s thought processes).
- While it is common practice to do recalibration between trials, this is not always possible or feasible (for example, in studies where task completion time is measured or where an interruption might impact on contextual information or the participant’s thought processes).
I prefer (2) but find (1) acceptable.
By the way, don't forget to check with any relevant bosses, professors, periodicals or publishers to see if they have a recommended style guide that can answer this question more authoritatively for your particular audience.