フィルターのクリア

How to cut out/delete rows in a cell

3 ビュー (過去 30 日間)
Simon Preuss
Simon Preuss 2020 年 11 月 5 日
コメント済み: Simon Preuss 2020 年 11 月 5 日
Hello,
i want to cut out the first 100 rows in the cell and dont know how. I tried the following code, but that just starts at the 127th value
for u = 1:5
for i = 1:5
mu_short_Mess_20kmh_HA{u,i} = mu_20kmh_all_VA{u,i}(126:end);
mu_mean_cell_Mess_20kmh_HA{u,i} = mean(mu_short_Mess_20kmh_HA{u,i});
end
end
If it doesn't work as simple as i think it could I'm looking forward for any suggestions.

採用された回答

VBBV
VBBV 2020 年 11 月 5 日
% if true
% code
%end
for u = 1:5
for i = 1:5
mu_short_Mess_20kmh_HA{u,i} = mu_20kmh_all_VA{u,i}(101:end,:);
mu_mean_cell_Mess_20kmh_HA{u,i} = mean(mu_short_Mess_20kmh_HA{u,i});
end
end
  1 件のコメント
Simon Preuss
Simon Preuss 2020 年 11 月 5 日
Thanks, thats what i was looking for.

サインインしてコメントする。

その他の回答 (2 件)

Monika Jaskolka
Monika Jaskolka 2020 年 11 月 5 日
編集済み: Monika Jaskolka 2020 年 11 月 5 日
It removes up to the 127th element because that's what the code says to do where it has (126:end).
If you want to remove the first 100 rows, you should do the following:
mu_short_Mess_20kmh_HA{u,i} = mu_20kmh_alle_VA{u,i}(101:end,:);
For more information about accessing elements in a matrix, see the Array Indexing page.

dpb
dpb 2020 年 11 月 5 日
mu_mean_Mess_20kmh_HA=cellfun(@(c) mean(c(126:end,:)),mu_20kmh_all_VA);
Don't need explicit loop; you just forgot the column colon subscript to pull all the columns for the wanted rows.

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by