Delete rows in intervall

1 Ansicht (letzte 30 Tage)
René Dienemann
René Dienemann am 17 Sep. 2019
Bearbeitet: madhan ravi am 17 Sep. 2019
Hi, I hava very long data table. There are rows in this table that I want to delete.
I have four rows, then I have three rows I want to delete, then 4 rows, then three rows I want to delete,
and so on ... .
For a better explanation see the pic. How can I achieve this?
Thanks for your help
Best regards Renématlab-problem.jpg

Akzeptierte Antwort

madhan ravi
madhan ravi am 17 Sep. 2019
Bearbeitet: madhan ravi am 17 Sep. 2019
An another alternative:
ix = (5:7:size(TABLE,1)) + [0;1;2];
%if > 2016b ix = bsxfun(@plus, 5:7:size(TABLE,1), [0;1;2])
TABLE(ix(ix<=size(TABLE,1)),:) = []
%or if you want to delete only in chunks of three then
TABLE(ix(:,all(ix<=size(TABLE,1))),:) = []

Weitere Antworten (1)

the cyclist
the cyclist am 17 Sep. 2019
If your vector is a multiple of 7 in length, then this will work:
x = reshape(x,7,[]);
x = x(1:4,:);
x = x(:);

Kategorien

Mehr zu Automotive finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by