Extracting values from an array which correspond to values from another array
10 views (last 30 days)
Show older comments
Joshua Chambers
on 21 Feb 2017
Commented: Joshua Chambers
on 21 Feb 2017
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
0 Comments
Accepted Answer
Stephen23
on 21 Feb 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
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!