フィルターのクリア

Is it possible to receive an output of non-equivalence in a given range?

1 回表示 (過去 30 日間)
Sumara
Sumara 2019 年 6 月 7 日
コメント済み: madhan ravi 2019 年 6 月 8 日
I have a 64x11 table consisting of values between the numbers 1 and 10, is it possible to retreive all values the numbers in a given row are not equal to?
e.g. row 1, consists of the numbers: 1 3 4 5 5 8 2 4 1 1 1
is it possible to receive an output of all of the values 1 to 10 that none of these values are equal to: 6 7 9 10

採用された回答

Walter Roberson
Walter Roberson 2019 年 6 月 7 日
result = rowfun(@(varargin) setdiff(1:10, cell2mat(varargin)), YourTable, 'OutputFormat', 'cell')
  4 件のコメント
Walter Roberson
Walter Roberson 2019 年 6 月 8 日
rowfun applied to a table is a bit odd, in that it breaks the values out to one per variable -- which makes some sense in the context of a table because table variables can be mixed data types.
In this context that means that rowfun is going to pass in 11 different variables to the function. That is a bit of a nuisance to deal with by name. Fortunately all of them are numeric, so we can have MATLAB bundle them all together into a cell by using varargin, and we can convert that cell to vector with cell2mat.
madhan ravi
madhan ravi 2019 年 6 月 8 日
Well explained sir Walter that’s why you’re MATLAB’s GOAT.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by