Convert categorical to string

조회 수: 80 (최근 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 CenterFile Exchange에서 Categorical Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by