条件に沿って数値を変換する
Show older comments
スプレットシートで数値の配列があります.
これを下記のようにグループ分けルールに沿って変換し,
スプレットシートやテキストで保存したいです.
■グループ分けルール
入力 → 変換後の出力
1 → 1
2~5 のいずれかの場合 → 2
6,8,10 のいずれかの場合 → 3
7,9,11 のいずれかの場合 → 4
■変換
入力 → 変換後の出力
1 → 1
2 → 2
5 → 2
9 → 4
Accepted Answer
More Answers (1)
%Random data for example
in = randi(11, 1, 10)
out = discretize(in, 0:11, [1 2 2 2 2 3 4 3 4 3 4], 'IncludedEdge', 'right')
2 Comments
H.O
on 26 Feb 2024
Atsushi Ueno
on 26 Feb 2024
I like it! This is exactly the MATLAB skills!
Categories
Find more on スプレッドシート in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!