How can I store arrays in container maps
9 ビュー (過去 30 日間)
古いコメントを表示
Hi all, I am very new to matlab and I have some questions on container map. I would like to know how to store arrays under container map. I have the following simple code, but it cannot give me the array desired. How can I do that?
keySet = {'1,1', '1,2'}
valueSet = [[2 3], [3 4]];
M = containers.Map(keySet,valueSet)
M('1,1')
2 件のコメント
Dyuman Joshi
2022 年 8 月 18 日
valueSet must have 2 elements, corresponding to keySet
%Using [] will result in joining all elements
valueSet = [[2 3], [3 4]]
keySet = {'1,1', '1,2'};
%use cell array
valueSet = {[2 3], [3 4]};
M = containers.Map(keySet,valueSet);
M('1,1')
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!