MATLAB: Delete the specific raw from a mat file

.mat filecelldelete rawMATLAB

I have a question about delete the specific raw in a mat file. I have a mat file like this (it is a cell)
'Enabled' 1 5.8
'Disabled' 0 2.1
'Enabled' 1 0.2
'Enabled' 1 6.4
'Enabled' 1 2.1
'Enabled' 1 12.5
...
I want to delete the raw if the number at column 3 is larger than 5. Namely, I will delete raw 1, raw 4 and raw 6 in this case since the corresponding number at column 3 are 5.8, 6.4 and 12.5, respectively (larger than the constraint 5). Then the remainding data will construct a new mat file, like that
'Disabled' 0 2.1
'Enabled' 1 0.2
'Enabled' 1 2.1
...
How to realize that? Thanks a lot!

Best Answer

c(cell2mat(c(:,3))>5,:) = [] % where c is your cell array