Info
This question is closed. Reopen it to edit or answer.
Regarding use of index to obtain the required code (Target avoiding loops)
1 view (last 30 days)
Show older comments
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.
0 Comments
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!