本文整理汇总了C++中NcVar::as_string方法的典型用法代码示例。如果您正苦于以下问题:C++ NcVar::as_string方法的具体用法?C++ NcVar::as_string怎么用?C++ NcVar::as_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NcVar
的用法示例。
在下文中一共展示了NcVar::as_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeResultsFile
//TODO optimize this thing
void writeResultsFile(string dataFileName, string yDimension, vector<double> * pValues)
{
NcFile file(dataFileName.c_str(), NcFile::ReadOnly);
NcVar *geneNames = file.get_var("gene");
int dataYsize = file.get_dim(yDimension.c_str())->size();
FILE * pFile;
pFile = fopen ("results.txt","w");
cout << "Writing results to file.." << endl;
int percentage = dataYsize / 10;
int percentageCount = 10;
for(int i = 0; i < dataYsize; i++){
char * c = geneNames->as_string(i*28);
std::string str;
if(pValues->at(i) > 0.05){
std::ostringstream strs;
strs << pValues->at(i);
str = strs.str();
}else{
str = "NA";
}
fprintf (pFile, "%-20s-%20s", c, str.c_str());
fprintf (pFile, "\n");
if(i == percentage)
{
cout << percentageCount << "% complete" << endl;
percentageCount += 10;
percentage += dataYsize / 10;
}
delete c;
}
fclose(pFile);
}