Replacement for the function containers.Map()

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Replacement for the function containers.Map()

GK19
Hi all
I hope you are doing good.
I was doing some project, I found out a function called containers.Map () and it works fine according to the logic.
I wanted to know if there is an alternative to that function?
The version of the Matlab that I am using does not support this function. Could you please help me out?


Reply | Threaded
Open this post in threaded view
|

Re: Replacement for the function containers.Map()

José Abílio Matos

On Wednesday, 10 June 2020 10.17.59 WEST Ganesh Kini wrote:

> Hi all

> I hope you are doing good.

> I was doing some project, I found out a function called containers.Map () and it works fine according to the logic.

> I wanted to know if there is an alternative to that function?

>

> The version of the Matlab that I am using does not support this function. Could you please help me out?

 

According to its documentation it has been introduced in R2008b. So you should be using a very old version.

Note that I have not used it I am just citing the documentation that usually is correct...

 

--

José Matos



Reply | Threaded
Open this post in threaded view
|

Re: Replacement for the function containers.Map()

GK19
In reply to this post by GK19
Can someone help me out ?

On Wed, Jun 10, 2020 at 11:17 AM Ganesh Kini <[hidden email]> wrote:
Hi all
I hope you are doing good.
I was doing some project, I found out a function called containers.Map () and it works fine according to the logic.
I wanted to know if there is an alternative to that function?
The version of the Matlab that I am using does not support this function. Could you please help me out?


Reply | Threaded
Open this post in threaded view
|

Re: Replacement for the function containers.Map()

apjanke-floss
In reply to this post by GK19


On 6/10/20 5:17 AM, Ganesh Kini wrote:
> Hi all
> I hope you are doing good.
> I was doing some project, I found out a function called containers.Map
> () and it works fine according to the logic.
> I wanted to know if there is an alternative to that function?
> The version of the Matlab that I am using does not support this
> function. Could you please help me out?
>

I don't think there's anything in Octave that supports containers.Map
now. But if you
put in a feature request on the Tablicious issue tracker, I'll get it
implemented in a few days.

https://github.com/apjanke/octave-tablicious/issues

Cheers,
Andrew


Reply | Threaded
Open this post in threaded view
|

Re: Replacement for the function containers.Map()

GK19
Containers.map(keys, values) works in octave new version. But since I am working for someone the octave version over there doesn't support this function. 
I will explain the problem here 
keys = {"ac","bc","cc"}; values = {"t_post","u_post","v_post" };
M = containers.Map(keys, values);
I have a functionality where I get the value of the key and when I pass it
Value = M(keys);

the output will look like t_post = M(ac), similarly 2nd index of keys should point to the 2nd index of Values and so on.
for example
 for ac - output should be t_post
 bc - it should be u_post 
cc - it should be v_post

On Wed, Jun 10, 2020, 4:26 PM Andrew Janke <[hidden email]> wrote:


On 6/10/20 5:17 AM, Ganesh Kini wrote:
> Hi all
> I hope you are doing good.
> I was doing some project, I found out a function called containers.Map
> () and it works fine according to the logic.
> I wanted to know if there is an alternative to that function?
> The version of the Matlab that I am using does not support this
> function. Could you please help me out?
>

I don't think there's anything in Octave that supports containers.Map
now. But if you
put in a feature request on the Tablicious issue tracker, I'll get it
implemented in a few days.

https://github.com/apjanke/octave-tablicious/issues

Cheers,
Andrew


Reply | Threaded
Open this post in threaded view
|

Re: Replacement for the function containers.Map()

apjanke-floss


On 6/10/20 10:39 AM, Ganesh Kini wrote:

> On Wed, Jun 10, 2020, 4:26 PM Andrew Janke <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>
>
>     On 6/10/20 5:17 AM, Ganesh Kini wrote:
>      > Hi all
>      > I hope you are doing good.
>      > I was doing some project, I found out a function called
>     containers.Map
>      > () and it works fine according to the logic.
>      > I wanted to know if there is an alternative to that function?
>      > The version of the Matlab that I am using does not support this
>      > function. Could you please help me out?
>      >
>
>     I don't think there's anything in Octave that supports containers.Map
>     now. But if you
>     put in a feature request on the Tablicious issue tracker, I'll get it
>     implemented in a few days.
>
>     https://github.com/apjanke/octave-tablicious/issues
>
>     Cheers,
>     Andrew
>
 > Containers.map(keys, values) works in octave new version. But since I am
 > working for someone the octave version over there doesn't support this
 > function.
 > I will explain the problem here
 > keys = {"ac","bc","cc"}; values = {"t_post","u_post","v_post" };
 > M = containers.Map(keys, values);
 > I have a functionality where I get the value of the key and when I
pass it
 > Value = M(keys);
 >
 > the output will look like t_post = M(ac), similarly 2nd index of keys
 > should point to the 2nd index of Values and so on.
 > for example
 >   for ac - output should be t_post
 >   bc - it should be u_post
 > cc - it should be v_post
 >

(please "bottom post" on this list)

I stand corrected! Sorry, if containers.Map is already in newer Octaves,
I won't be writing an implementation just for the old versions.

Cheers,
Andrew


Reply | Threaded
Open this post in threaded view
|

Re: Replacement for the function containers.Map()

Carlo de Falco-2


> Il giorno 10 giu 2020, alle ore 17:40, Andrew Janke <[hidden email]> ha scritto:
>
> I stand corrected! Sorry, if containers.Map is already in newer Octaves, I won't be writing an implementation just for the old versions.

On the other hand, it looks like the implementation of the containers.Map class is m-file only :

  https://hg.savannah.gnu.org/hgweb/octave/file/f5c9bb5955e7/scripts/%2Bcontainers

so if the "old" version of Octave you want to support is not too old (it must support packages and handle classes)
you may just instruct your user to save the directory +containers somewhere in their path and they should then be
able to use it.


c.






Reply | Threaded
Open this post in threaded view
|

Re: Replacement for the function containers.Map()

GK19
so if the "old" version of Octave you want to support is not too old (it must support packages and handle classes)
you may just instruct your user to save the directory +containers somewhere in their path and they should then be
able to use it.  
How do i do that ? Could you please elaborate ?

On Wed, Jun 10, 2020 at 5:50 PM Carlo De Falco <[hidden email]> wrote:


> Il giorno 10 giu 2020, alle ore 17:40, Andrew Janke <[hidden email]> ha scritto:
>
> I stand corrected! Sorry, if containers.Map is already in newer Octaves, I won't be writing an implementation just for the old versions.

On the other hand, it looks like the implementation of the containers.Map class is m-file only :

  https://hg.savannah.gnu.org/hgweb/octave/file/f5c9bb5955e7/scripts/%2Bcontainers

so if the "old" version of Octave you want to support is not too old (it must support packages and handle classes)
you may just instruct your user to save the directory +containers somewhere in their path and they should then be
able to use it.


c.






Reply | Threaded
Open this post in threaded view
|

Re: Replacement for the function containers.Map()

Carlo de Falco-2


Il giorno 10 giu 2020, alle ore 18:10, Ganesh Kini <[hidden email]> ha scritto:

How do i do that ? Could you please elaborate ?
click on the link I put in my previous post and download the files you see.
that is the implementation of the containers.Map class.

c.


Reply | Threaded
Open this post in threaded view
|

Re: Replacement for the function containers.Map()

GK19
Okay, but where do I need to place this? Could you please let me know in detail?

On Wed, Jun 10, 2020 at 7:25 PM Carlo De Falco <[hidden email]> wrote:


Il giorno 10 giu 2020, alle ore 18:10, Ganesh Kini <[hidden email]> ha scritto:

How do i do that ? Could you please elaborate ?
click on the link I put in my previous post and download the files you see.
that is the implementation of the containers.Map class.

c.


Reply | Threaded
Open this post in threaded view
|

Re: Replacement for the function containers.Map()

siko1056
On 6/11/20 2:49 AM, Ganesh Kini wrote:
> Okay, but where do I need to place this? Could you please let me know in
> detail?
>

Again, bottom posting [1]!  Reply below the old message.

As Carlo said, download Maps.m from


https://hg.savannah.gnu.org/hgweb/octave/file/f5c9bb5955e7/scripts/%2Bcontainers

Create in your working directory a folder "+containers" note the "+"
prefix and put "Maps.m" inside.  Then you can use

   containers.Map

If you want to update your Octave installation, you can find out the
directory by

   which help

and put the folder "+containers" containing "Maps.m" there.

HTH,
Kai

[1] https://en.wikipedia.org/wiki/Posting_style#Bottom-posting


Reply | Threaded
Open this post in threaded view
|

Re: Replacement for the function containers.Map()

GK19
Thanks All,

It works fine for the containers.map

On Thu, Jun 11, 2020 at 4:22 AM Kai Torben Ohlhus <[hidden email]> wrote:
On 6/11/20 2:49 AM, Ganesh Kini wrote:
> Okay, but where do I need to place this? Could you please let me know in
> detail?
>

Again, bottom posting [1]!  Reply below the old message.

As Carlo said, download Maps.m from


https://hg.savannah.gnu.org/hgweb/octave/file/f5c9bb5955e7/scripts/%2Bcontainers

Create in your working directory a folder "+containers" note the "+"
prefix and put "Maps.m" inside.  Then you can use

   containers.Map

If you want to update your Octave installation, you can find out the
directory by

   which help

and put the folder "+containers" containing "Maps.m" there.

HTH,
Kai

[1] https://en.wikipedia.org/wiki/Posting_style#Bottom-posting