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
댓글 수: 0
채택된 답변
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 Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!