character vector vs scalar string (size comparison).

조회 수: 4 (최근 30일)
Osama Alkurdi
Osama Alkurdi 2020년 11월 10일
편집: Stephen23 2020년 11월 11일
can any one explain to me why the character vector 'matlab' have a smaller size than the scalar string "matlab" despite that they carry the same information, can any one explain this in simple answer, and can you give me links explain how matlab store data?

채택된 답변

Stephen23
Stephen23 2020년 11월 10일
편집: Stephen23 2020년 11월 11일
The string class is basically a fancy container class for character vectors. That is to say, inside every string element is a character vector, so bytes_string > bytes_character will always hold true for the "same" text.
Of course because the string class is a container class, it also has its own overhead, as described here:
Unfortunately this page has not been updated for string arrays, but the information given for cell arrays will be similar:

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by