Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing matrices with different length

Status
Not open for further replies.

Zerzura

Agricultural
Joined
May 29, 2012
Messages
1
Location
DE
Hi there,

I need your help with the following task.
I am trying to compare the two following matrices with each other
A=[8 8 8 8 %month
1 1 1 1 %day
1 2 4 5 %hour
1 2 3 4] %values

B=[8 8 8 8 8 %month
1 1 1 1 1 %day
1 2 3 4 5] %hour

Of course there are not only gaps in the hourly row but also in the daily row.

The resulting matrix should look like that
C=[8 8 8 8 8
1 1 1 1 1
1 2 3 4 5
1 2 NaN 3 4]

The script should check which dates are equal in the matrices A and B and also write the values which I have in the Matrix B and a NaN value in Matrix B if there is a gap.

Thanks in advance for your help!
 
Student posting is not allowed

TTFN
faq731-376
7ofakss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top