octave-maintainers
[Top][All Lists]
Advanced

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

More import help


From: Rik
Subject: More import help
Date: Wed, 9 Aug 2017 16:33:58 -0700

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




reply via email to

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