フィルターのクリア

Insert an array into another array

3 ビュー (過去 30 日間)
evangeline
evangeline 2018 年 3 月 2 日
回答済み: James Tursa 2018 年 3 月 2 日
I need to insert an array into another array, so that subarray would be like one single element in it, like: A=[2,4,5,[5,6],9] so if I use numel on this array, it should give me 5. How can I do this in matlab? And if I do this how can I have access to the subarray elemets?

採用された回答

James Tursa
James Tursa 2018 年 3 月 2 日
You can't do this with double class variables, where you are limited to one value per element. But you could use a cell array for this. E.g.,
A = {2,4,5,[5,6],9};
Then use the curly braces to get at the values. E.g., A{1}, A{2}, etc.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by