求助,如何从二维数组中调用数据在Graph控件上显示
我是先从txt中调出数据(数字),放入Table中,本想从Table中调出来再显示到Graph控件上,但是怎么都不显示波形,实在不明白,我是新手,多多帮忙,谢谢! 把你的代码贴出来吧?这样没发知道问题在那里. double table;char str;
char string;
int CVICALLBACK ok (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
FILE *fp;
char str1,str2,str3,str4,str5,str6,
str7,str8,str9,str10,str11,str12;
int i;
char *fileName;
char projectDir;
char fullPath;
switch (event)
{
case EVENT_COMMIT:
fileName="txt.txt";
GetProjectDir(projectDir);
MakePathname(projectDir,fileName,fullPath);
fp=fopen (fullPath, "r");
for(i=1;i<32;i++)
{
fseek(fp,0+37*(i-1),0);
fread(str1,2,1,fp);
fseek(fp,3+37*(i-1),0);
fread(str2,2,1,fp);
fseek(fp,6+37*(i-1),0);
fread(str3,2,1,fp);
fseek(fp,9+37*(i-1),0);
fread(str4,2,1,fp);
fseek(fp,12+37*(i-1),0);
fread(str5,2,1,fp);
fseek(fp,15+37*(i-1),0);
fread(str6,2,1,fp);
fseek(fp,18+37*(i-1),0);
fread(str7,2,1,fp);
fseek(fp,21+37*(i-1),0);
fread(str8,2,1,fp);
fseek(fp,24+37*(i-1),0);
fread(str9,2,1,fp);
fseek(fp,27+37*(i-1),0);
fread(str10,2,1,fp);
fseek(fp,30+37*(i-1),0);
fread(str11,2,1,fp);
fseek(fp,33+36*(i-1),0);
fread(str12,2,1,fp);
SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(1,i),str1);
SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(2,i),str2);
SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(3,i),str3);
SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(4,i),str4);
SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(5,i),str5);
//在运行时,从txt调用的数据从str6--str12存在问题,读不到table中,如果删除了就可以读出前面五个//
SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(6,i),str6);
SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(7,i),str7);
SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(8,i),str8);
SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(9,i),str9);
SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(10,i),str10); SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(11,i),str11);
SetTableCellVal(panelHandle,PANEL_TABLE,MakePoint(12,i),str12);
}
fclose(fp);
break;
}
return 0;
}
int CVICALLBACK graphdd (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{ switch (event)
{ case EVENT_COMMIT:
SetRange(panel,PANEL_SCALE,EVENT_COMMIT,0,0,0);
DeleteGraphPlot(panel,PANEL_GRAPHDD,-1,VAL_IMMEDIATE_DRAW);
PlotWaveform(panel,PANEL_GRAPHDD,table,100,VAL_DOUBLE,1,0,0,1,VAL_THIN_LINE,VAL_EMPTY_SQUARE,VAL_SOLID,1,VAL_RED);
WaveformGraphPopup(string,str,1,VAL_CHAR,1,0,0,1);
//用PlotWaveform和WaveformGraphPopup这两种函数我都没显示出来//
break; }
return 0;
} 我想来想去都没明白,还请大家指点指点
页:
[1]