| MATLAB Central > MATLAB Newsreader > Creating graphs of data from multiple datafiles |
|
|
|
Subject: Creating graphs of data from multiple datafiles From: Amy Clare Date: 16 Jun, 2010 15:36:06 Message: 1 of 10 |
|
I am trying to create a graph showing multiple datasets of the same type of data in the same format from files currently in a .txt or.dat format. I also have them in excel format. The datasets represent a data value vs time given in the same units in all files. |
|
Subject: Creating graphs of data from multiple datafiles From: Rob Campbell Date: 16 Jun, 2010 16:07:05 Message: 2 of 10 |
|
So each data file contains two columns? One with time and with your value? If that's the case then it's pretty straightforward. Yes, you need to write a function. The easiest thing is probably to read in the text files. You would do something like this: |
|
Subject: Creating graphs of data from multiple datafiles From: Paul Hanson Date: 16 Sep, 2010 16:04:04 Message: 3 of 10 |
|
Rob, |
|
Subject: Creating graphs of data from multiple datafiles From: Rob Campbell Date: 16 Sep, 2010 16:37:05 Message: 4 of 10 |
|
"Paul Hanson" <paul.hanson@mpi.com> wrote in message <i6tf5k$1ft$1@fred.mathworks.com>... |
|
Subject: Creating graphs of data from multiple datafiles From: Paul Hanson Date: 16 Sep, 2010 19:32:21 Message: 5 of 10 |
|
> However, why are you trying to make a 980x6 matrix? Why not an N-by-2 matrix? Does the same row across files mean the same thing? If so, you obviously have missing data. Why not first make all files have the same number of rows? |
|
Subject: Creating graphs of data from multiple datafiles From: Paul Hanson Date: 16 Sep, 2010 19:59:22 Message: 6 of 10 |
|
Not one to be a slacker, here's what I've got so far... |
|
Subject: Creating graphs of data from multiple datafiles From: Rob Campbell Date: 16 Sep, 2010 20:02:20 Message: 7 of 10 |
|
I think you want to have the same number of rows for each matrix. So you final matrix will have the same number of rows as your smallest file. You'll want to do this for the PCA, I think. As you go through and do the import, store your data in a cell array: |
|
Subject: Creating graphs of data from multiple datafiles From: Paul Hanson Date: 16 Sep, 2010 20:17:21 Message: 8 of 10 |
|
> Incidentally, wouldn't all the odd columns be the same since they are time? In that case you'd probably want to make the matrix with only the dependent variable: |
|
Lots of cool tricks in that code of yours! Thanks! I've run into a snag that is primarily a function of understanding arrays. Here's the code: |
|
|
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
