Remove entire row if sum is lesser than parameter

조회 수: 2 (최근 30일)
Eduardo
Eduardo 2014년 1월 14일
답변: Anand 2014년 1월 14일
So, I have this cell array of numbers, and I want to delete a entire row if the sum of its values are lesser than a predetermined number. I tried using for loop and while loop but it's too slow due to the size of my cell array. Is there any way of doing this using cell fun?
example: cell1 =
[1] [2] [3]
[0] [0] [0]
[4] [5] [6]
then I want only rows where the sum is greater than 10.
cell1 =
[4] [5] [6]
Thanks.

채택된 답변

Anand
Anand 2014년 1월 14일
Try this:
>> cell1(find(sum(cell2mat(cell1),2)>10),:)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by