From a matrix creating a vector

1 回表示 (過去 30 日間)
Emilia
Emilia 2022 年 7 月 24 日
コメント済み: Star Strider 2022 年 7 月 24 日
Hello,
I have matrix
A=[1 7 3 9 4; 8 6 8 9 1; 7 7 7 8]
I need to find the existing numbers from the matrix and create a vector, for example like this Vector1=[1 3 4 6 7 8 9]
and also count the numbers several times, for example like this Vector2=[2 1 1 1 4 3 2]
Thanks for the helpers :)
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2022 年 7 月 24 日
unique and histcounts will help you
Emilia
Emilia 2022 年 7 月 24 日
Thank you !

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

採用された回答

Star Strider
Star Strider 2022 年 7 月 24 日
Use the unique and accumarray or histcounts functions.
This appears to be homework, so I leave the coding to you.
  2 件のコメント
Emilia
Emilia 2022 年 7 月 24 日
Thank you !
Star Strider
Star Strider 2022 年 7 月 24 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by