File Exchange

image thumbnail

merge function

version (1.63 KB) by Ryan Verburg
[M] = merge(m1,m2) Takes 2 matrices with elements (including NaN) and combines them


Updated 29 Jun 2020

View License

Takes 2 2-dimensional matrices with (NaN) elements and combines them, replacing NaN with real values from either matrix. If sizes dont match, expands the matrices from point (1,1) . If the element of m1 is a number and the same element of m2 is also a number, pick from m1 over m2.

Useful for working with matrices with incomplete data that could complete one another.

Cite As

Ryan Verburg (2020). merge function (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

MATLAB Release Compatibility
Created with R2019b
Compatible with R2012a to R2019b
Platform Compatibility
Windows macOS Linux