Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to eliminate the rows of data ?

2 ビュー (過去 30 日間)
Andre
Andre 2014 年 8 月 12 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have a large data-set.The data in cell. A sample of this data-set is as follows:
I want to eliminate the number of rows of data that is less than 3 lines in a set (shown in red box). Can I have a simple code to do this?
  1 件のコメント
Christopher Berry
Christopher Berry 2014 年 8 月 12 日
編集済み: Christopher Berry 2014 年 8 月 14 日
How is your data stored? double? cell? table? What size is it?
chances are, all you need to do is
rows = [1 4 10];
data(rows,:) = [];
This will remove rows 1 4 and 10 from a 2D matrix of doubles

回答 (2 件)

Joakim Magnusson
Joakim Magnusson 2014 年 8 月 12 日
Is your data i a matrix? I'm not sure what you want to remove, but for example if you want to remove the first 5 rows, i think you could do like this:
yourMatrix(1:5, :) = [];
But i guess you want to recognize some kind of pattern and remove the rows with the specific pattern?

Ben11
Ben11 2014 年 8 月 12 日
If your data is stored in a cell array you could use the following:
% Identify the rows (I) in which there are empty elements
[I,J] = ind2sub(size(YourArray),find(cellfun(@(x) isempty(x),YourArray)))
% Find the unique entries
RowsToDelete = unique(I)
% Delete them
YourArray(RowsToDelete,:) = [];

Community Treasure Hunt

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

Start Hunting!

Translated by