How to represent set?
10 ビュー (過去 30 日間)
古いコメントを表示
Newbie here try to implement an algorithm in MATLAB but do not know how to represent set.
For example, when initiate the algorithm, i need to:
Set
.
And
.
I tried this
C{0} = [] % Error: Array indices must be positive integers or logical values.
C{1} = 1:N
I am not sure how to set empty set and if I am doing right with C_1.
Can anyone help me?
Thanks!
0 件のコメント
採用された回答
Ameer Hamza
2020 年 4 月 26 日
In MATLAB, the index starts from 1. So the first line should be
C{1} = [];
The variable should also be defined before its use. So you need to specify define
N = 10;
C{2} = 1:N;
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!