Thread Subject: how to construct empty containers.Map with integer KeyType

Subject: how to construct empty containers.Map with integer KeyType

From: Danny Shevitz

Date: 14 Jul, 2009 20:42:03

Message: 1 of 3

Howdy,

this is real simple but I can't figure it out. How do I construct an empty
containers.Map with integer KeyType. The default is char, and Matlab autodetects
numeric types if they are given as keys, but I want to start with an empty map.

thanks,
Danny

Subject: how to construct empty containers.Map with integer KeyType

From: Kwok Chong

Date: 24 Aug, 2009 13:22:04

Message: 2 of 3

Hi Danny,

Currently, at the time of writing this reply, there is no way to do this. The workaround is to construct with dummy variables of the right type, and them remove the dummy entries.

Please see Technical Solution # 1-71KD5H for more details:
http://www.mathworks.com/support/solutions/en/data/1-71KD5H/

Kwok

"Danny Shevitz" <shevitz@lanl.gov> wrote in message <h3iqir$p2d$1@fred.mathworks.com>...
> Howdy,
>
> this is real simple but I can't figure it out. How do I construct an empty
> containers.Map with integer KeyType. The default is char, and Matlab autodetects
> numeric types if they are given as keys, but I want to start with an empty map.
>
> thanks,
> Danny

Subject: how to construct empty containers.Map with integer KeyType

From: Matt Fetterman

Date: 21 Oct, 2009 17:39:07

Message: 3 of 3

Is it helpful to preallocate a containers.Map array ? If so, how do you preallocate it? Thanks Matt


"Kwok Chong" <Kwok.chong@mathworks.co.uk> wrote in message <h6u45s$ppm$1@fred.mathworks.com>...
> Hi Danny,
>
> Currently, at the time of writing this reply, there is no way to do this. The workaround is to construct with dummy variables of the right type, and them remove the dummy entries.
>
> Please see Technical Solution # 1-71KD5H for more details:
> http://www.mathworks.com/support/solutions/en/data/1-71KD5H/
>
> Kwok
>
> "Danny Shevitz" <shevitz@lanl.gov> wrote in message <h3iqir$p2d$1@fred.mathworks.com>...
> > Howdy,
> >
> > this is real simple but I can't figure it out. How do I construct an empty
> > containers.Map with integer KeyType. The default is char, and Matlab autodetects
> > numeric types if they are given as keys, but I want to start with an empty map.
> >
> > thanks,
> > Danny

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com