Why doesnt int2str return string

조회 수: 4 (최근 30일)
David Zhang
David Zhang 2021년 6월 24일
댓글: David Zhang 2021년 6월 24일
Here is my code as as you can see I wanted to convert the element in row 1 column 4 from an int 1 to a string using int2str, but upon using isstring it turns out that it isn't one. Anybody know why?

채택된 답변

millercommamatt
millercommamatt 2021년 6월 24일
It's turned your value into a char, not a string.
ischar(int2str(F{1,4})) should return true
If you look at the function help for int2str, you'll see this:
int2str returns character arrays only. Starting in R2016b, you can convert numeric arrays to string arrays using the string function.
  댓글 수: 1
David Zhang
David Zhang 2021년 6월 24일
Thank you so much it works now

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by