|
|
Copy Rows from One Matrix to Another
I have used xlsread to create two matrices in Matlab. They aren't the same size or shape but two columns in both contain the same sort of data. I'd like to search for data that meets some criteria and then copy those rows from that matrix to another. I'd love any advice.
|
|
0
|
|
|
|
Reply
|
Amy
|
11/9/2010 8:19:04 PM |
|
"Amy " <asopinka@uvic.ca> wrote in message <ibcabo$6c8$1@fred.mathworks.com>...
> I have used xlsread to create two matrices in Matlab. They aren't the same size or shape but two columns in both contain the same sort of data. I'd like to search for data that meets some criteria and then copy those rows from that matrix to another. I'd love any advice.
Provide a small set of example data, expected results, and why those results are expected and we'll be able to help you. You've given us no real incite to your problem.
|
|
0
|
|
|
|
Reply
|
Sean
|
11/9/2010 9:25:06 PM
|
|
"Amy " <asopinka@uvic.ca> wrote in message <ibcabo$6c8$1@fred.mathworks.com>...
> I have used xlsread to create two matrices in Matlab. They aren't the same size or shape but two columns in both contain the same sort of data. I'd like to search for data that meets some criteria and then copy those rows from that matrix to another. I'd love any advice.
Please provide a more specific question. What, exactly, do you need help with? What do your matrices look like? Do you need help with how to search, or how to copy rows, or both? etc. etc. Maybe you could provide a short example showing some inputs and desired outputs.
James Tursa
|
|
0
|
|
|
|
Reply
|
James
|
11/9/2010 9:26:04 PM
|
|
"Amy " <asopinka@uvic.ca> wrote in message <ibcabo$6c8$1@fred.mathworks.com>...
> I have used xlsread to create two matrices in Matlab. They aren't the same size or shape but two columns in both contain the same sort of data. I'd like to search for data that meets some criteria and then copy those rows from that matrix to another. I'd love any advice.
Could you provide an example?
To paraphrase, what is meant by copy the rows where the columns are similiar?
If the matricies aren't the same size, do they at least have the same number of rows (or columns)?
|
|
0
|
|
|
|
Reply
|
someone
|
11/9/2010 9:32:04 PM
|
|
The first matrix has 10 columns and is about 3800 row. One of the columns is the hour and another has a price.
The second matrix has 6 columns and 81 rows and also has a column for the hour and another for the price.
I want to sort the second matrix by hour and copy the rows (or possibly just some cells) to the first matrix so that all the data is in one place i.e. all the hour 1 data is in matrix one, then do the same for hours 2 to 24.
"someone" <someone@somewhere.net> wrote in message <ibcekk$jf0$1@fred.mathworks.com>...
> "Amy " <asopinka@uvic.ca> wrote in message <ibcabo$6c8$1@fred.mathworks.com>...
> > I have used xlsread to create two matrices in Matlab. They aren't the same size or shape but two columns in both contain the same sort of data. I'd like to search for data that meets some criteria and then copy those rows from that matrix to another. I'd love any advice.
>
> Could you provide an example?
>
> To paraphrase, what is meant by copy the rows where the columns are similiar?
>
> If the matricies aren't the same size, do they at least have the same number of rows (or columns)?
|
|
0
|
|
|
|
Reply
|
Amy
|
11/9/2010 9:55:05 PM
|
|
"Amy " <asopinka@uvic.ca> wrote in message <ibcfvp$h35$1@fred.mathworks.com>...
> The first matrix has 10 columns and is about 3800 row. One of the columns is the hour and another has a price.
> The second matrix has 6 columns and 81 rows and also has a column for the hour and another for the price.
>
> I want to sort the second matrix by hour and copy the rows (or possibly just some cells) to the first matrix so that all the data is in one place i.e. all the hour 1 data is in matrix one, then do the same for hours 2 to 24.
>
doc sortrows
doc vertcat
|
|
0
|
|
|
|
Reply
|
Sean
|
11/9/2010 10:12:03 PM
|
|
"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <ibcgvj$lbj$1@fred.mathworks.com>...
> "Amy " <asopinka@uvic.ca> wrote in message <ibcfvp$h35$1@fred.mathworks.com>...
> > The first matrix has 10 columns and is about 3800 row. One of the columns is the hour and another has a price.
> > The second matrix has 6 columns and 81 rows and also has a column for the hour and another for the price.
> >
> > I want to sort the second matrix by hour and copy the rows (or possibly just some cells) to the first matrix so that all the data is in one place i.e. all the hour 1 data is in matrix one, then do the same for hours 2 to 24.
> >
>
> doc sortrows
> doc vertcat
hi Amy, try sorting the valu using MS EXCEL and get the matrices back in matlab window using the excelink function.
|
|
0
|
|
|
|
Reply
|
Tobi
|
11/9/2010 10:48:03 PM
|
|
|
6 Replies
549 Views
(page loaded in 0.052 seconds)
|
|
|
|
|
|
|
|
|