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

10 次查看(过去 30 天)
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

采纳的回答

Stephen23
Stephen23 2017-2-21
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by