Change string words to number in table
7 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a table where one column contains words like 'Clear', ' Clouds' and 'Rain'.
I want to replace those for values like 1,2 and 3.
Anyone who can help me with this?
0 件のコメント
採用された回答
Chunru
2021 年 10 月 15 日
% Assume the column has the data
x.omst=["Clouds"; "Rain"; "Clear"]
% You can use the categorical data
x.omst = categorical(x.omst);
disp(x.omst)
% Or numbers
x.omst = double(categorical(x.omst));
disp(x.omst)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!