Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: How to compare matrices and insert rows
Replies: 3   Last Post: Jan 24, 2013 2:03 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 7,871
Registered: 6/7/07
Re: How to compare matrices and insert rows
Posted: Jan 23, 2013 12:47 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.