Change string words to number in table
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dion Theunissen
am 15 Okt. 2021
Beantwortet: Chunru
am 15 Okt. 2021
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 Kommentare
Akzeptierte Antwort
Chunru
am 15 Okt. 2021
% 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Find more on Characters and Strings 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!