我正在使用包含Mathematica中的y坐标集的.raw文件绘制图。我不确定要输入的内容直接引用文件中的数据 - 我目前使用的是“数据”,但不确定这是否正确。从Mathematica中的.raw文件中读取数据
这是我的代码:
SetDirectory[$HomeDirectory <> "/Documents/Project/Work/Output"]
alldirs = FileNames["deBB-*"]
alllocdata = {};
Do[
SetDirectory["./" <> alldirs[[idir]]];
Print["--- working on " <> (dirname = alldirs[[idir]])];
allfiles = FileNames["T-*.raw"];
Do[
Print[" --- working on " <> (filename = allfiles[[ifile]])];
ReadList[filename, Number];
AppendTo[alllocdata, data];
Print[ListPlot[data, Frame -> True, PlotRange -> {0, 2000},
DataRange -> {0, 10000},
AxesOrigin -> {0, 0}]], {ifile, Length[allfiles]}
];
SetDirectory[ParentDirectory[]],
{idir, Length[alldirs]}
]
我已经收到此错误:
ListPlot::lpn: data is not a list of numbers or pairs of numbers. >>
任何帮助,将不胜感激。
你能给出一组“数据”中前几项的样本吗? – 2012-07-24 14:24:49
例如一个是: 702.00000 704.00000 706.00000 708.00000 .... 并持续10000分的结果。 – 2012-07-24 14:30:33
所以它看起来像'data = {702.00000,704.00000,706.00000,708.00000}'或'data =“702.00000 704.00000 706.00000 708.00000”'? – 2012-07-24 14:43:56