Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Regarding use of index to obtain the required code (Target avoiding loops)

1 vue (au cours des 30 derniers jours)
Shashi
Shashi le 24 Jan 2012
Clôturé : MATLAB Answer Bot le 20 Août 2021
Query: Suppose i have a bigger matrix (in my case image) named as I. Now, i make a function as
[r,c,v]=find(I>128);
Now i have got the index of rows and columns in two different arrays. Now, i want to extract all those values from bigger matrix for those corresponding rows and columns and multiply those values with a value (let it be x)..and all other values which are not in [r,c] to be multiplied by (let it be 'y')
Can you suggest something for it, without going through for loop.
What i tried was this:
Given: r= array of rows stored size=[p,1] c=array of columns stored=[p,1] I is the original matrix (image in my case)
Implementation:
h=I(r,c); h2=diag(h); h2=h2*x; p=I-h2; p=p*y;
Well, i did try this but the result was ambiguous. Is there some better way to implement this. I am able to do it through loops but i want to implement through matrices only.
All suggestions are most welcome.

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by