# Index value intersection query in matlab

1 visualizzazione (ultimi 30 giorni)
Ramesh Bala il 16 Mar 2021
Commentato: Ramesh Bala il 16 Mar 2021
I'm trying to calculate the intersection value of x,y from a matrix.
The loop seems correct but the values that I get seems wrong,when I try to run it alone it gives me right values ?
Lets assume a be some double with 32 points and b too same 32 points ,I'm trying to intersect both in rms(279x249 double)
This below one works but when I try to put the same in loop it doesn't why ?
ex (1,:) = rms(b(1),a(1));
ex (2,:) = rms(b(2),a(2));
a = round (x);
b = round (y);
for k = 1:length(a)
for l = 1:length(b)
index (k,:) = rms(b(l),a(k));
end
end
index = index';
return
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

KSSV il 16 Mar 2021
a = round (x);
b = round (y);
for k = 1:length(a)
index (k,:) = rms(b(k),a(k));
end
index = index';
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Ramesh Bala il 16 Mar 2021
Yes I've figured it out,but thank you for quick answer KSSV.

Accedi per commentare.

### Categorie

Scopri di più su Matrix Indexing in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by