Please tell me how to change the type?

void a(){
TCanvas *c1 = new TCanvas(“c1”, “c1”,10,10,600,600);
c1->SetGridx();
c1->SetGridy();
gStyle->SetOptStat(“0000”);

TH2F *h2 = new TH2F(“h2”,"",4,0,2,4,0,2);
h2->Draw();
h2->GetXaxis()->SetNdivisions(4);
//h2->GetXaxis()->SetTitle(“t”);
h2->GetXaxis()->CenterTitle(true);

h2->GetYaxis()->SetNdivisions(4);
h2->GetYaxis()->SetTitle(“j_{s}(#Omega,t)”);
h2->GetYaxis()->CenterTitle(true);

FILE *fp=fopen("/home/Administrator/out/data.prn",“r”);
TFile *f=new TFile(“data.root”,“RECREATE”);
TTree *t=new TTree(“T”,“data from ascii file”);
Float_t x[200][1201];
t.Branch(“x”,x,“x[200][1201]/F”);

Int_t r,c;
for(r=0;r<200;r++)
{
for(c=0;c<1201;c++)
{
fscanf(fp,"%f",&x[r][c]);
//printf("%.3f ",x[r][c]);
}
printf(“r=%d\n”,r);
t->Fill();
}

for(c=1;c<1201;c++)
{
h2->Draw();
t->SetMarkerColor(4);
t->SetMarkerStyle(20);
t->SetMarkerSize(0.3);

    t->Draw(Form("x[][%d]:x[][0]",c),"","same");
    h2->SetTitle(Form("#Omega=%.3f",c*0.01));
    h2->GetXaxis()->SetTitle(Form("#Omega=%.3f",c*0.01));
     
    c1->Print(Form("/home/Administrator/pic/%d.gif",c));

}

// t->Draw(“x[][125]:x[][0]”,"",“same”);
//t->Draw(“x[][1]:x[][0]”,“x[][0]>0.5”,“same”);

//c1->Print(“3d.gif”);
c1->Modified();

}

i run this programm,but all result is:
[size=150][color=blue]Error: Incorrect assignment to c, wrong type ‘int’ t.c:47:[/color][/size]

why?
please tell me how to change it
Thanks!
a.c (1.45 KB)
data.rar (241 KB)

Hi,

can you attach the script, please? And even better: a version that I can run without the input file? Do the same error still happen when you convert your code into a named macro, i.e. instead of the enclosing {…} you define it as void t() {…}? If that solves it: you have another unnamed macro that defines some variable called “c” of a different type. You should really always use named macros.

Axel.

[quote=“Axel”]Hi,

can you attach the script, please? And even better: a version that I can run without the input file? Do the same error still happen when you convert your code into a named macro, i.e. instead of the enclosing {…} you define it as void t() {…}? If that solves it: you have another unnamed macro that defines some variable called “c” of a different type. You should really always use named macros.

Axel.[/quote]

Thanks!
i change the macros,but still not solve it
What should i do ?

Hi,

as I said: attach the version of your script that is a named macro and that does not rely on input data, so I can run it myself.

Cheers, Axel.

[quote=“Axel”]Hi,

as I said: attach the version of your script that is a named macro and that does not rely on input data, so I can run it myself.

Cheers, Axel.[/quote]

Thanks!
Programm is still not run. i change the name and do what you tell me.
[color=blue]$ root -l td.c
root [0]
Processing td.c…
Warning: wrong member access operator ‘.’ td.c:23:
Error: Incorrect assignment to column, wrong type ‘int’ td.c:48:
*** Interpreter error recovered ***
root [1] [/color]

why ?please help me?
td.c (1.41 KB)
data.rar (241 KB)

I gues it should be like this
td.c (1.36 KB)

Thanks!
It is run!
[color=blue]Speed is faster[/color]
Thank you very much!