Indices of 'convolution' aka finding indicies of one matrix from a set of matrices in another matrix

3 visualizzazioni (ultimi 30 giorni)
Hi
I'm wondering if there is an efficient way to do the following.
Set up:
A=randi(2,10,3); B=(A(:,1)==1); C=A(B); indsOfC=myfun(C);
So C is a matrix whose rows are just those where A had a first column of 1, and inds is the result of doing some function with C as its argument. What I'm wondering is if there is an easy way of relating the indicies of C to the indices of A.
Thanks

Risposte (1)

Fangjun Jiang
Fangjun Jiang il 9 Set 2011
Not very clear what you are asking. Using your example, if you run [I,J,V]=find(B), is the matrix I what you are looking for?

Categorie

Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by