octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More import help


From: Burgers, A.R. (Teun)
Subject: Re: More import help
Date: Thu, 10 Aug 2017 08:13:36 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Op 10-8-2017 om 1:33 schreef Rik:
I have some more code samples to run in Matlab for someone who has access.

Test #1:

Make a file myfunc.m with the following

--File myfunc.m--
function retval = myfunc ()
   retval = Map ('a', 1);
import containers.Map
end
--End File--

At the command line, execute 'myfunc'.  Does it return a Map object, or
does it complain that Map does not exist?

Test #2:

--File myfunc2.m--
function retval = myfunc2 (flag)
   if (flag)
     import containers.Map
   end

   retval = Map ('a', 1);
end
--End File--

At the command line try

myfunc2 (0)
myfunc2 (1)

It is really awkward to support conditional imports, and Matlab itself
warns that you shouldn't do it, but I do wonder if it throws an error, a
warning, or just processes it somehow.

Thanks,
Rik





>> myfunc

ans =

  Map with properties:

        Count: 1
      KeyType: char
    ValueType: double

>> myfunc2(0)

ans =

  Map with properties:

        Count: 1
      KeyType: char
    ValueType: double

>> myfunc2(1)

ans =

  Map with properties:

        Count: 1
      KeyType: char
    ValueType: double




reply via email to

[Prev in Thread] Current Thread [Next in Thread]