Azzera filtri
Azzera filtri

Access matrix location on one matrix with the data location on another matrix

1 visualizzazione (ultimi 30 giorni)
I have two matrix say A & B if I have data stored in A and the data location of desired values in B how could I access Values of matrix A who are located at locations B.

Risposta accettata

Chinmay Anand
Chinmay Anand il 21 Giu 2019
In case if A and B are vectors ,( 1 x n ) matrices
A(B) % It will give the values of A at indexes B
  3 Commenti

Accedi per commentare.

Più risposte (1)

madhan ravi
madhan ravi il 21 Giu 2019
Probably you want:
idx = setdiff(1:numel(A),B);
A(idx) = 0;

Community Treasure Hunt

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

Start Hunting!

Translated by