What Is A Scalar String?

조회 수: 122 (최근 30일)
Jay
Jay 2019년 6월 24일
댓글: Jay 2019년 6월 24일
Can someone please tell me what is meant by "scalar string object"?
I am finding it difficult to understand how a string can be a scalar (to me, scalars represent a multiplier?).
I have searched the MathWorks Documentation (Define String Scalar Inputs [states how to define a string scalar but not what one is]) and still can not wrap my head around what is meant.
Does the "Scalar String" defintion mean single elements comprising of multiple strings, for example:
A (1,1) = "Todays Date Is June 24th, 2019" as a string
A (1,1) = "Todays" "Date" "Is" "June" "24th," "2019" as a scalar string object
or am I completely off the mark?
  댓글 수: 5
Walter Roberson
Walter Roberson 2019년 6월 24일
Scalar in computer programs usually means "exactly one item". In MATLAB scalar numbers are also array that are 1x1. In many programming languages, arrays and scalars are considered to be different data types. For example in C if you have
A = 42;
Then that is a scalar value, and you cannot use A[0] (array indexing starts at 0 in C)
In MATLAB, a scalar string object holds exactly one string, which is a complete vector of characters.
Jay
Jay 2019년 6월 24일
Thank you David and Walter for further explaining what a Scalar String means.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by