Array: Difference between <missing> and [] ??

조회 수: 1 (최근 30일)
Josy M
Josy M 2020년 7월 9일
댓글: madhan ravi 2020년 7월 9일
Hello Guys,
Whats the difference between:
  • "s" and 's'
  • <missing> and []
How can i create such fields?
THANKS. :)

답변 (2개)

Apoorv Singh
Apoorv Singh 2020년 7월 9일
's' is a char array where "s" denotes a string.
[] is an empty array. You can find more info on <missing> here

Steven Lord
Steven Lord 2020년 7월 9일
For your first question, see the "Text in String and Character Arrays" Topic on this documentation page.
For the second, missing returns a scalar value (and so you can store it in an element of a normal array) while [] returns a 0-by-0 value (and so trying to include it in an array may fail because of size mismatches.)
x = [1 missing; 3 4] % works, result is 2-by-2
y = [1 []; 3 4] % fails because row 1 would have 1 element and row 2 would have 2 elements
  댓글 수: 1
madhan ravi
madhan ravi 2020년 7월 9일
Yes so they are stored as a cell array in those fields.

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

카테고리

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