Change string words to number in table
5 次查看(过去 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!