Matlab矩阵处理。
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
大家好!我现在有个几千行的矩阵,按照第一列的ID从大到下进行排列得到的,现在想把第一列ID数量小于20的ID删除掉,请问怎么样才可以做到
谢谢大家!
例如:data = [1 2 2;1 0 2;2 1 4;2 3 6;2 5 6;3 2 1;3 6 5;3 7 8;3 6 4]
data =
1 2 2
1 0 2
2 1 4
2 3 6
2 5 6
3 2 1
3 6 5
3 7 8
3 6 4
将第一列数量小于3的行删除掉,变成
data =
2 1 4
2 3 6
2 5 6
3 2 1
3 6 5
3 7 8
3 6 4
0 Kommentare
Antworten (1)
Chunru
am 16 Mai 2023
data = [1 2 2;1 0 2;2 1 4;2 3 6;2 5 6;3 2 1;3 6 5;3 7 8;3 6 4]
data(data(:, 1)<3, :) =[]
0 Kommentare
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!