0

I've asked this before, but I feel I wasn't clear enough so I'll try again.

I am running a network simulation, and I have several hundreds output files. Each file holds the simulation's test result for different parameters.

There are 5 different parameters and 16 different tests for each simulation. I need a method to store all this information (and again, there's a lot of it) in Matlab with the purpose of plotting graphs using a script. suppose the script input is parameter_1 and test_2, so I get a graph where parameter_1 is the X axis and test_2 is the Y axis.

My problem is that I'm not quite familier to Matlab, and I need to be directed so it doesn't take me forever (I'm short on time).

How do I store this information in Matlab? I was thinking of two options:

  1. Each output file is imported separately to a different variable (matrix)
  2. All output files are merged to one output file and imprted together. In the resulted matrix each line is a different output file, and each column is a different test. Problem is, I don't know how to store the simulation parameters Edit: maybe I can use a dataset?

So, I would appreciate any suggestion of how to store the information, and what functions might help me fetch the only the data I need.

4

3 回答 3

1

如果您仍然想尝试使用 matlab 解决此问题,您可以遍历所有文件并逐个导入它们。您可以使用该功能创建文件夹内容的列表

ls(name)

你可以像这样导入数据:

A = importdata(filename)

如果您的数据在 txt 文件中,您应该考虑这个Prev Q

避免使您的工作区混乱的一个好策略是将它们全部导入一个矩阵中。因此,如果您有一个名为 VAR 的矩阵,那么 VAR{1,1}.{1,1} 可能是您放置测试结果的位置,而 VAR{1,1}.{2,1} 可能是您放置模拟的位置第一个文件的参数。我认为这比制作数据结构更简单。只需确保将信息统一放置在数组的相同索引中即可。您还可以通过参数与测试来组织您的 VAR 行 v col。

这更符合您的第一个建议

每个输出文件分别导入到不同的变量(矩阵)

您的第二个建议似乎没有必要,因为您可以遍历您的文件。

于 2012-08-18T17:36:40.240 回答
0

您可以使用该命令save来存储您的数据。它非常方便,并且可以存储您的硬盘可以容纳的尽可能多的数据。

文档在那里: http: //www.mathworks.fr/help/techdoc/ref/save.html

于 2012-08-18T17:29:05.717 回答
0

描述文本文件的格式。因为如果它具有系统格式,那么您可以dlmread在 matlab 中使用或类似的命令并读取矩阵中的文本文件。从那里,您可以轻松地进行绘图。如果您尝试在 excel 中执行此操作,它会比从文本文件中读取要慢得多。如果速度对您来说是个问题,我建议您不要使用 Excel。

于 2012-08-19T00:59:56.660 回答