How to index variables from column B based on column A condtion
조회 수: 1 (최근 30일)
이전 댓글 표시
I have an array of variables with 2 columns.
A containing input and B containing output.
looks something like this
A=[ 200;200;200...;400;400;...;600;600]
B[5.5;6.5;6.0...;8.5;9.6;....;14.3;18.4]
how do i index the values in column B into seperate arrays based on column A values?
im sure it involves logical indexing just not sure the procedure
댓글 수: 0
채택된 답변
Cris LaPierre
2022년 3월 22일
Logical indexing and assignment
A = [1 2];
B = [3 4];
% assign results to new variables
C = B(A==1)
D = B(A==2)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!