I keep on getting an error when using mapObj

>> k1 = M1(:,1)
>> k2 = M(:,5)
>> val1 = M1(:,2:4)
>> val2 = M1(:,6:11)
>> keyset = {k1,k2}
>> valueset = [val1,val2]
>> mapObj = containers.Map(keyset,valueset)
Error using containers.Map
Unsupported key specified. See documentation for valid key types.
I don't know how to get pass this error, I have tried using both cellfun(@str2num,k1&2); aswell as [strcat({' '}, num2str(k1&2))] to get the keys into supported key but I still get the same message. If anyone could help that would be fantastic.

2 件のコメント

Adam
Adam 2016 年 7 月 29 日
編集済み: Adam 2016 年 7 月 29 日
What is M1? i.e. what also is the type of k1 and k2?
'char', 'double', 'single', 'int32', 'uint32', 'int64', or 'uint64'. are the supported key types for a containers.Map
avedakid
avedakid 2016 年 7 月 29 日
M1 is a cell array, and k1&k2 are char's As you can see I am trying to link the keys in columns 1 & 5 to the values in columns 2:4 & 6:11. If I look at the document both keys in char form are accepted, perhaps not my overall matrix (M1 - cell array). I will keep on working on it - if you have any other advise that would be fantastic thanks Adam.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

質問済み:

2016 年 7 月 29 日

コメント済み:

2016 年 7 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by