필터 지우기
필터 지우기

Is possible select specific rows with all column in a loop?

조회 수: 5 (최근 30일)
Hello.
I have a data matrix like the following
1 -5.01E-01 0.00E + 00
1.0865 1.09E-01 0.00E + 00
1.173 1.09E-01 0.00E + 00
1.2911 1.09E-01 0.00E + 00
1.4329 1.09E-01 0.00E + 00
1.6219 1.09E-01 0.00E + 00
1.811 1.09E-01 0.00E + 00
2 1.09E-01 0.00E + 00
2.3333 1.38E-01 0.00E + 00
2.6667 1.38E-01 0.00E + 00
3 1.38E-01 0.00E + 00
3.001 -2.15E-02 0.00E + 00
3.0023 -2.15E-02 0.00E + 00
3.004 -2.15E-02 0.00E + 00
3.0062 -2.15E-02 0.00E + 00
3.009 -2.15E-02 0.00E + 00
3.0128 -2.15E-02 0.00E + 00
3.0176 -2.15E-02 0.00E + 00
3.0239 -2.15E-02 0.00E + 00
3.032 -2.15E-02 0.00E + 00
3.0426 -2.15E-02 0.00E + 00
3.0564 -2.15E-02 0.00E + 00
3.0743 -2.15E-02 0.00E + 00
3.0976 -2.15E-02 0.00E + 00
3.1279 -2.15E-02 0.00E + 00
3.1673 -2.15E-02 0.00E + 00
3.2185 -2.15E-02 0.00E + 00
3,285 -2.15E-02 0.00E + 00
3.3744 -2.15E-02 0.00E + 00
3.4787 -2.15E-02 0.00E + 00
3.609 -2.15E-02 0.00E + 00
3.8045 -2.15E-02 0.00E + 00
4 -2.15E-02 0.00E + 00
4.25 1.55E-02 0.00E + 00
4.625 1.55E-02 0.00E + 00
5 1.55E-02 0.00E + 00
5.5 5.26E-02 0.00E + 00
6 5.26E-02 0.00E + 00
for this example how to get the integer values of column one (1, 2, 3, 4, 5 and 6) with all its columns.
Could it be done automatically? since I have a big matrix
I will really appreciate your valuable help.
Orlando

채택된 답변

Walter Roberson
Walter Roberson 2021년 6월 14일
mask = ismembertol(YourArray, 1:6);
selected_rows = YourArray(mask,:);
G = round(selected_rows(:,1));
split_groups = splitapply(@(M){M}, selected_rows, G)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by