Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • 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
May 29, 2012
1
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!
 
Replies continue below

Recommended for you

Student posting is not allowed

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

Part and Inventory Search

Sponsor