The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

Posts: 9,850
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.



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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.