Replace values in a matrice
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Miguel Albuquerque
il 17 Lug 2022
Modificato: Miguel Albuquerque
il 19 Lug 2022
Hey guys, thanks in advance,
I have this range(matrix) that has 1 x 5600 values. After that I perform a calculation , and I get a distance_matrix, that has 1 x 400 values.
Range includes the values in distance_matrix
What I want to do, is find in range the indexes where the values of distance_matrix are, and replace them by RMC, but such as, range continues to have 1 x 5600 values.
How can I do that?
0 Commenti
Risposta accettata
dpb
il 17 Lug 2022
Modificato: dpb
il 17 Lug 2022
Seems you're going over and over the same plowed ground here...use logical addressing.
isR=isfinite(D);
R(isR)=RMC;
or
isD=ismember(R,D);
R(isD)=RMC;
5 Commenti
dpb
il 19 Lug 2022
Well, that doesn't match the computed values or you wouldn't have the mismatch in lengths...
The code put a NaN or Inf out of range and 0 at the origin; the calculation of whatever was over the values in range which are the finite elements -- makes no sense otherwise.
Miguel Albuquerque
il 19 Lug 2022
Modificato: Miguel Albuquerque
il 19 Lug 2022
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Write Unit Tests in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!