Array: Difference between <missing> and [] ??
1 回表示 (過去 30 日間)
古いコメントを表示
Hello Guys,
Whats the difference between:
- "s" and 's'
- <missing> and []
How can i create such fields?
THANKS. :)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/329489/image.png)
0 件のコメント
回答 (2 件)
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
0 件のコメント
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!