Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
Shashi
Shashi el 24 de En. de 2012
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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.

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by