Cell Array indexing and manipulating
古いコメントを表示
The following code is entered in the command window:
A = {'Cal', 'Golden', 'Bears', [5 7], {[1 2 3 4]}};
Enter a single-line command the extract the number 3 from A
A{5}{1}(3)
Hello, I am confused about this problem. Why wouldn't the answer be A{5}{3} ??
1 件のコメント
Image Analyst
2014 年 8 月 2 日
Have you read the FAQ: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F It should give you an intuitive appreciation for cell arrays.
採用された回答
その他の回答 (1 件)
Andrei Bobrov
2014 年 8 月 2 日
編集済み: Andrei Bobrov
2014 年 8 月 2 日
A = {'Cal', 'Golden', 'Bears', [5 7], {1 2 3 4}};
A{5}{3}
or
>> A = {'Cal', 'Golden', 'Bears', [5 7], [1 2 3 4]};
>> A{5}(3)
ans =
3
>>
1 件のコメント
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!