Consult

hello,

I have a problem that I want to output a variable’s value in different pads in a for loop in one macro. for example:

[color=red]float var;
TCanvas *c=new TCanvas(“c”,“c”);
c->Divide(5,4);
for (int i=0; i<20; i++) {
var=var+i;
c->cd(i);
// here I want to output the variable ‘var’ in this sub-pad
}
[/color]

I see the User’s Guide, but I can not find how to do it. Can you help me?

Best regard
foolfish

see example below:

{ float var; TCanvas *c=new TCanvas("c","c"); c->Divide(5,4); TText t; t.SetTextSize(0.10); t.SetTextAlign(22); for (int i=1; i<=20; i++) { var=var+i; c->cd(i); // pad range is by default [0,1] t.DrawText(.5,0.5,Form("var=%f",var)); } }
Rene