How to separate four columns on the basis of 5th column
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello, I hope you are doing well. I have the following Dataset in which I have five column. I want to seperate the data based on fifth column.
Like if the fifth column has the value 1, then all the four column related to value 1 save in new cell.
댓글 수: 0
답변 (2개)
Harsh Saxena
2023년 6월 1일
Hi,
To do this you can use the following logic:
% just to load data
data = load('Dataset.mat');
x = data.Dataset;
%
A = x([x(:, 5)] == 1, :);
A will be an array which will contain only the rows with fifth column element as 1.
Hope this helps!
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!