|
"Alexander " <aimmler@gmail.com> wrote in message <irb9fc$lbr$1@newscl01ah.mathworks.com>...
> I have two matrices. Nr.1 is a 469x7 and Nr.2 is a 469x20
>
> Both are logicals containing ones and zeros. There are always less ones in Nr.1 than in Nr.2. Also, Nr.1 is a sub sample of Nr.2.
>
> Each matrix represents signals which I now want to put "together" to form a combined signal matrix.
>
> Example:
> Nr.1: [1,0,0,0,0,0,1] --> signal for the first and the seventh element
> Nr.2: [1,0,1,0,1,0,1,0,0,1,0,0,1, 1 ,1,0,0,0,0,1] --> signal wherever there is a one. The "seventh" one in the row is seperated by spaces.
>
> As result I want to have:
> Nr.3:[1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0]
>
> Does anyone have an idea how to do that?
>
> Thanks.
- - - - - - - - - -
N3 = false(469,20);
for k = 1:469
f = find(N2(k,:));
N3(k,f(find(N1(k,:)))) = true;
end
This assumes that "There are always less ones in Nr.1 than in Nr.2" really means that the number of true's in each row of N2 is always as great as the column number of the last 'true' in that row of N1.
Roger Stafford
|