Convert categorical to string

144 ビュー (過去 30 日間)
NAVNEET NAYAN
NAVNEET NAYAN 2021 年 10 月 2 日
コメント済み: Ellis 2025 年 6 月 9 日
I have two categorical column vectors of size 872-by-1. I want to calculate the Levenshtein distance between these two. When I am using the command 'editDistance' for this I am getting an error as
"Argument 1 must be a string array, a character vector, or a cell array of character vectors."
After searching the solution for this problem, I thought to convert it to string, but I am not getting a way for this. How can I convert categorical column vector to string? or how can I resolve the error?
In case of any query feel free to comment.

採用された回答

Stephen23
Stephen23 2021 年 10 月 2 日
移動済み: Stephen23 2024 年 12 月 17 日
V1 = categorical([1,2,3,2,2,1])
V1 = 1×6 categorical array
1 2 3 2 2 1
V2 = categorical([3,1,2,2,1,1])
V2 = 1×6 categorical array
3 1 2 2 1 1
S1 = string(V1)
S1 = 1×6 string array
"1" "2" "3" "2" "2" "1"
S2 = string(V2)
S2 = 1×6 string array
"3" "1" "2" "2" "1" "1"
  4 件のコメント
Stephen23
Stephen23 2024 年 12 月 17 日
@Mike Croucher: there are no points for comments. Feel free to move!
Ellis
Ellis 2025 年 6 月 9 日
@basket random, Is this what you need?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCategorical Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by