フィルターのクリア

how convert string in struct with 0/1

1 回表示 (過去 30 日間)
aldo
aldo 2023 年 11 月 3 日
回答済み: Stephen23 2023 年 11 月 3 日
>> class(Sis)
ans =
'struct'
>> size(Sis)
ans =
1 351
i access it using : Sis(1).FilterSkip
Sis.FilterSkip can to be "No" or "Si" or "Rank"
if Sis.FilterSkip ="No" i want to get 0.
.if Sis.FilterSkip="Si" i want to get 1
i want to create vector wih 0 or 1 using Sis.FilterSkip
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 11 月 3 日
What should be the value when Sis.FilterSkip is "Rank"?
aldo
aldo 2023 年 11 月 3 日
if it's "Rank" ignore value

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

採用された回答

Stephen23
Stephen23 2023 年 11 月 3 日
S = struct('FS',{'Si','No','Si','Rank','No'})
S = 1×5 struct array with fields:
FS
Z = nan(size(S));
[X,Y] = ismember({S.FS},{'No','Si'});
Z(X) = Y(X)-1
Z = 1×5
1 0 1 NaN 0

その他の回答 (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