Subtracting two matrices of date values

2 visualizzazioni (ultimi 30 giorni)
Chameleon17
Chameleon17 il 20 Ott 2015
Modificato: Chameleon17 il 20 Ott 2015
Good afternoon,
I'm editing this a great deal, as I've been going round in circles with this problem all day from different angles.
Hopefully I will be able to post this and it will make sense this time. I also apologize for posting too much with simple problems.
My problem is this, I have two matrices, both 8x183 double.
Mat1:
732166 732167 732168 732169 732170 732171 732172 732173
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 732168 0 0 0 0 0
0 0 0 0 0 0 0 0
Mat2:
Columns 129 through 136
732166 732167 732168 732169 732170 732171 732172 732173
0 0 0 0 0 0 732172 0
0 0 0 0 0 0 732172 0
0 0 0 0 732170 732171 732172 0
0 0 0 0 0 0 732172 0
0 0 0 0 0 732171 732172 0
0 0 0 0 0 732171 732172 0
0 0 0 0 0 0 732172 0
The matrices are made up of zeros and date numbers. I need to keep everything in order by rows and columns. For each row I would like to find, if there is a value in the row for matrix 1, the difference in the values in matrix two for the same row. So how many dates are listed either before or after the date listed in matrix one.
As I mentioned, I've been going round in circles... and formats. I think i've confused myself. Can anybody help point me in the right direction as to how to go about this? any help as always will be very much appreciated!
Thank you for your time too!
  2 Commenti
Star Strider
Star Strider il 20 Ott 2015
Attach a .mat file of your cell arrays. (See the documentation for the save function for details.) Then attach them to your original Question here, first using ‘Edit’, then the ‘paperclip’ icon, completing both the ‘Choose file’ and ‘Attach file’ steps.
We can’t provide any reliable solutions without having at least a sample of your data.
Chameleon17
Chameleon17 il 20 Ott 2015
Hi, I've attached the matrices. I have a great deal of these to work through though. The future problems after this simple one I need to address are multiple dates in the rows of Mat1 and to calculate the amount of dates that occur in matrix two before and after each of these multiple dates... but that's after the basics are sorted.

Accedi per commentare.

Risposte (1)

Steven
Steven il 20 Ott 2015
Type in datevec in the console and hit the F1 key, matlab has an excellent help system. You may need to convert you date vectors to a different format with cell2mat.

Categorie

Scopri di più su Dates and Time in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by