Extracting specific numbers from a vector
11 ビュー (過去 30 日間)
古いコメントを表示
How can I extract a specific number from a vector, saving the new vector minus the extracted number as a new variable, and saving the counted extracted number as a new variable?
eg. Extracting '-20' from the following.
A = [2 4 6 5 6 5 4 3 -20 4 6 7 -20 3 4 5 6 1 -20];
A1 = [2 4 6 5 6 5 4 3 4 6 7 3 4 5 6 1];
A2 = 3
0 件のコメント
回答 (2 件)
Azzi Abdelmalek
2016 年 8 月 19 日
編集済み: Azzi Abdelmalek
2016 年 8 月 19 日
idx=ismember(A,-20)
A1=A(~idx)
A2=sum(idx)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Dynamic System Models についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!