Removing some elements from a vector

1 回表示 (過去 30 日間)
hdr mhr
hdr mhr 2013 年 6 月 1 日
回答済み: davood fouladi 2014 年 8 月 23 日
I have a vector that consists of some numbers in the following way: A = [153 244 253 353 453 530 653 ...] The pattern is that there is always 153,253,353,...,2353 (these represent time i.e. 1:53am,...11:53pm) for a day. In between these *53 numbers there are some numbers that I don't wish to keep them. For example between 353 and 453, a 433 appears which needs to be removed from the vector. So the final result I wish to get is vector A = [153 253 353 ...2353] (of course in the original vector I have, this pattern for one day is repeated for a whole year).
Any thought on how to do this?
I would really appreciate any answer.

採用された回答

the cyclist
the cyclist 2013 年 6 月 1 日
編集済み: the cyclist 2013 年 6 月 1 日
First, try to define an index that identifies the values you don't want. It sounds like this will do it:
idx = not((mod(A,100)==53));
Then, you can use that index to remove the unwanted values:
A(idx) = [];
  4 件のコメント
the cyclist
the cyclist 2013 年 6 月 5 日
I suggest you open up a new question for this. New questions buried in comments of old questions don't get much "traffic". Be sure to give enough detail that someone can understand what you are trying to do, without reference to this one.
hdr mhr
hdr mhr 2013 年 6 月 6 日
Sure I will do so, thanks.

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

その他の回答 (1 件)

davood fouladi
davood fouladi 2014 年 8 月 23 日
For example,5 elements are removed from x=1:10 x(5)=[] Now what should I be removed for a number of

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by