How to delete rows or move rows in the 2D Matrix

1 回表示 (過去 30 日間)
Naufal Arfani
Naufal Arfani 2021 年 1 月 4 日
編集済み: KALYAN ACHARJYA 2021 年 1 月 4 日
I have a problem that is I have a 2D matrix of [11x1000] with the image below, it can be seen that in the initial row the value is all 0, is there an easy way to delete the initial 0 value so that it becomes [10x1000]? Or maybe move the initial row to the last row to keep the number of elements? Please help me. because I can't continue to findpeaks when the initial value is 0. thanks a lot

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 1 月 4 日
編集済み: KALYAN ACHARJYA 2021 年 1 月 4 日
"I have a problem that is I have a 2D matrix of [11x1000] with the image below, it can be seen that in the initial row the value is all 0, is there an easy way to delete the initial 0 value so that it becomes [10x1000]?"
Lets consider data variable as 2D input Matrix
data(~(sum(data,2)==0),:)
After this assignment, there will be no rows in the data matrix with all zero elements. If in later section of code may require original data, in that case please do copy with another variable.

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by