Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
Shashi
Shashi am 24 Jan. 2012
Geschlossen: MATLAB Answer Bot am 20 Aug. 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.

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by