Extracting values from an array which correspond to values from another array

10 vues (au cours des 30 derniers jours)
Hi
I have three equal-length arrays: x, y and c.
c ranges from 0 - 415, x from 0 - 1 and y from 0 - 1500.
I want to select the data from c which have values <50, and then select the corresponding data from the other two arrays.
I can find the required values for c, but cannot find how to select the data from the other arrays.
Any help would be appreciated!
Josh

Réponse acceptée

Stephen23
Stephen23 le 21 Fév 2017
Read these:
And then check this out:
>> A = randi(9,1,9)
A =
4 7 7 4 5 4 7 3 1
>> B = rand(1,9)
B =
0.610330 0.959444 0.900687 0.967633 0.010723 0.783159 0.016694 0.609336 0.980585
>> idx = A<5;
>> A(idx)
ans =
4 4 4 3 1
>> B(idx)
ans =
0.61033 0.96763 0.78316 0.60934 0.98059

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by