From: Pr B on
edit: i do need two loops. the length of unique(data(:1)) is shorter than length(data), obviously. any suggestions?
From: Matt Fig on
Your explanation of what you are looking for still makes no sense to me. For example, what does this mean? "for the first row of X, corresponding to the entry 'a', i want a 1 wherever an element from column 2 is present" I don't see the connection between your X and your statement.

Can you give an actual, concrete example which can be copied and pasted of INPUT and OUTPUT? Are the elements of your cell array strings, numbers or what?


Also, the is should be probably be == not =:

find(unique_tgs = mod)
From: Pr B on
here is some explanation of the problem which i hope will help clarify things:

each row of the matrix X i want to create will correspond to the unique values of column 1 of 'data'. each column of X will correspond to the unique values of column 2 of 'data'.

let me describe this 'data' variable: 'data' is a mx2 cell array with column 1 representing 'modulator' variables and column 2 representing 'targets' of those modulator variables. in my example (a shortened version of my actual data), the 'data' variable can be read as: 'modulator a has targets by b2, c6, and a7. modulator b has targets b2, d3, and c6.'

based on this information, i want to create a matrix X described previously. the rows of X will represent each modulator and the columns of X will represent each target. a 1 will be placed whenever a modulator's targets are present in the 'data' variable.

i hope this makes things clear now. i think my code to create this X matrix is almost there...


"Matt Fig" <spamanon(a)yahoo.com> wrote in message <ht1tsg$qjt$1(a)fred.mathworks.com>...
> Your explanation of what you are looking for still makes no sense to me. For example, what does this mean? "for the first row of X, corresponding to the entry 'a', i want a 1 wherever an element from column 2 is present" I don't see the connection between your X and your statement.
>
> Can you give an actual, concrete example which can be copied and pasted of INPUT and OUTPUT? Are the elements of your cell array strings, numbers or what?
>
>
> Also, the is should be probably be == not =:
>
> find(unique_tgs = mod)
From: Pr B on
also, the elements of my arrays are strings like "a1", "jas23", and "dfh".

"Matt Fig" <spamanon(a)yahoo.com> wrote in message <ht1tsg$qjt$1(a)fred.mathworks.com>...
> Your explanation of what you are looking for still makes no sense to me. For example, what does this mean? "for the first row of X, corresponding to the entry 'a', i want a 1 wherever an element from column 2 is present" I don't see the connection between your X and your statement.
>
> Can you give an actual, concrete example which can be copied and pasted of INPUT and OUTPUT? Are the elements of your cell array strings, numbers or what?
>
>
> Also, the is should be probably be == not =:
>
> find(unique_tgs = mod)
First  |  Prev  | 
Pages: 1 2
Prev: surfer matlab vector quiver
Next: dB Conversion