Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
dpb
Posts:
6,850
Registered:
6/7/07
|
|
Re: How to compare matrices and insert rows
Posted:
Jan 23, 2013 12:47 PM
|
|
On 1/23/2013 11:14 AM, Mike wrote: ... > I have a vector (1x156) of dates in serial date format, these pertain to > a total series of sampling dates - a 'master_date' record, if you like. > I also have another vector (1x130) of dates that pertain to dates when a > specific parameter has been sampled sporadically throughout the total > sampling period. I will call this the parameter_date. > > What I want to do is compare the two vectors and at every instance the > parameter-date does not match the master_date, insert a rows of NaNs so > that the two vectors match. ...
Given
T % master vector t % sample vector
tN=T; % start w/ a complete set tN(~ismember(T,t))=NaN; % insert Nan where no entry
--
|
|
|
Date
|
Subject
|
Author
|
|
1/23/13
|
|
dpb
|
|
1/24/13
|
|
dpb
|
|
|