How does one use sum and isnan to compare values in rows located in different matrices?
doesn't work- data and matfor are the two matrices. I'm simply trying to add, for each iteration, the row in the columns of matrix data (from the 2nd onwards), with the 1st (non-zero) column of matfor2. The point of that line is to truncate the two columns at the point where both have non NaN values.
if I did this:
I wouldn't get an error message. ALL the data would be truncated to where the series with the most amount of NaNs starts getting values. But I don't want that. I want the loop to extract the largest possible span of data for combinations of two series.
I'm doing this in a loop and what I will be doing in the loop (won't present it here for clarity) requires stuff done to combinations of two columns, one -the 1st column in data- that doesn't change, and the other that changes at each iteration. The issue is that each time series may have different starts and ends in terms of data availability. So the span of the data, for each combination of column 1 and column ii, varies. For that reason, I have to adjust the length of the data every time. The way I've approached this is as follows:
matfor2(:,1) = data(:,1);