フィルターのクリア

find if a column vector contains at least element 1

2 ビュー (過去 30 日間)
Salvatore Mazzarino
Salvatore Mazzarino 2012 年 9 月 20 日
I have to check if column vector has at least element 1. Does Matlab have such similar function or I have to build it myself?
  3 件のコメント
Salvatore Mazzarino
Salvatore Mazzarino 2012 年 9 月 20 日
No I mean check if in the matrix there is at least 1 as a number.
Daniel Shub
Daniel Shub 2012 年 9 月 20 日
編集済み: Daniel Shub 2012 年 9 月 20 日
So do you mean any? It would help if you gave a couple of example vectors and what you expect.

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

採用された回答

Sean de Wolski
Sean de Wolski 2012 年 9 月 20 日
tf = any(A(:)==1)

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 20 日
編集済み: Azzi Abdelmalek 2012 年 9 月 20 日
length(a)
Or
numel(a)
  2 件のコメント
Salvatore Mazzarino
Salvatore Mazzarino 2012 年 9 月 20 日
No I don't mean check if the matrix has at lest one element. I would know if the matrix contains at least 1. For example:
A=[1 0 0]
this contains 1.
B=[0 0 0]
this contains all zeros.
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 20 日

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

カテゴリ

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