フィルターのクリア

How can I remove double value from vector?

7 ビュー (過去 30 日間)
Mira le
Mira le 2023 年 6 月 13 日
回答済み: Ronit 2023 年 6 月 13 日
Hello every one
I have this problem that I want you to help me to solve it
I have a cell array S={12 45 10 30}
and its equivalent double array sup_s which is the weight of S
sup_s=[5 10 3 2 1]
the problem is when i want to remove from S I remove the equivalent value from supp_s

回答 (1 件)

Ronit
Ronit 2023 年 6 月 13 日
S = {12 45 10 30};
sup_s = [5 10 3 2 1];
index_to_remove = 2;
S(index_to_remove) = [];
sup_s(index_to_remove) = [];
disp(S)
{[12]} {[10]} {[30]}
disp(sup_s)
5 3 2 1
Using this method, you can remove the element at any index from S and its equivalent from sup_s.

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by