Yotam
Yotam

Reputation: 10485

Need a method to store a lot of data in Matlab

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.

Upvotes: 0

Views: 176

Answers (3)

Autonomous
Autonomous

Reputation: 9075

Describe the format of text files. Because if it has a systematic format then you can use dlmread or similar commands in matlab and read the text file in a matrix. From there, you can plot easily. If you try to do it in excel, it will be much slower than reading from a text file. If speed is an issue for you, I suggest that you don't go for Excel.

Upvotes: 0

David Winer
David Winer

Reputation: 146

If you're still looking to give matlab a try with this problem, you can iterate through all the files and import them one by one. You can create a list of the contents of a folder with the function

ls(name)

and you can import data like this:

A = importdata(filename)

if your data is in txt files, you should consider this Prev Q

A good strategy to avoid cluttering your workspace is to import them all into a single matrix. SO if you have a matrix called VAR, then VAR{1,1}.{1,1} could be where you put your test results and VAR{1,1}.{2,1} could be where you put your simulation parameters of the first file. I think that is simpler than making a data structure. Just make sure you uniformly place the information in the same indexes of the arrays. You could also organize your VAR row v col by parameter vs test.

This is more along the lines of your first suggestion

Each output file is imported separately to a different variable (matrix)

Your second suggestion seems unnecessary since you can just iterate through your files.

Upvotes: 1

Oli
Oli

Reputation: 16035

You can use the command save to store your data. It is very convenient, and can store as much data as your hard disk can bear.

The documentation is there: http://www.mathworks.fr/help/techdoc/ref/save.html

Upvotes: 0

Related Questions