How to remove elements from two arrays when one of them has a zero

1 回表示 (過去 30 日間)
Giuseppe D'Amico
Giuseppe D'Amico 2021 年 3 月 3 日
コメント済み: Giuseppe D'Amico 2021 年 3 月 3 日
Hi everyone, I'll explain my problem.
I have two arrays of the same length which are called respectively: target_2019 and output_2019, what I am going to do is the difference between these two arrays and I calculate the MAPE. However, some of the values ​​present in target_2019 are zeros, how can I eliminate these zeros by simultaneously eliminating the measure that corresponds to this zero in the output_2019 array?
I hope I was clear.
Would anyone know how to help me?
  3 件のコメント
Giuseppe D'Amico
Giuseppe D'Amico 2021 年 3 月 3 日
thank you so much!
Giuseppe D'Amico
Giuseppe D'Amico 2021 年 3 月 3 日
How can I calculate the MAPE? If I divide the two arrays, I get a matrix

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

回答 (1 件)

the cyclist
the cyclist 2021 年 3 月 3 日
idx_to_remove = target_2019==0;
target_2019(idx_to_remove) = [];
output_2019(idx_to_remove) = [];

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by