필터 지우기
필터 지우기

What is the meaning of Adding a String to a Double?

조회 수: 4 (최근 30일)
Ajmal
Ajmal 2013년 6월 6일
{
x=17
x_s = num2str(x)
out = x_s+0
}
out is equal to [49 55] of type double
What exactly is going on?

답변 (1개)

Iain
Iain 2013년 6월 6일
Strings are represented as integer values.
A = 65, B = 66...
You can ADD numbers, say, 65 + 1, and you would get 66, which is also B.
Adding 0 to a string is just a cheap way of turning a string into a double.
Its like doing xor(A,A) to get 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