lundi 13 février 2017

How to sum a matrix with unaligned elements?

Vote count: 0

I am trying to sum in the second dimension a matrix QI in Matlab. The trick is, the columns contain a series of increasing numbers, but not all columns have the same number of elements (i.e. numel(QI(:,1)) ~= numel(QI(:,2)) and so on). For the sake of clarity, I attach a picture of it. Note that I padded the missing areas with 0, so the previous condition becomes nnz(QI(:,1)) ~= nnz(QI(:,2)).

Matrix QI

One initial strategy that I thought of was to treat this as an image and construct a mask for each different gradient level, but that seems like a tedious job.

Colored QI

Anyone has a better idea on how to do this? I should also mention that I am able to freely modify how QI is generated, but I'd rather not if there is a solution for this problem.

Thank you,

asked 28 secs ago

Let's block ads! (Why?)



How to sum a matrix with unaligned elements?

Aucun commentaire:

Enregistrer un commentaire