[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More import help
From: |
Richard Crozier |
Subject: |
Re: More import help |
Date: |
Thu, 10 Aug 2017 09:57:40 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 10/08/17 00:33, Rik wrote:
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?
R2016b
>> myfunc
ans =
Map with properties:
Count: 1
KeyType: char
ValueType: double
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)
>> myfunc2 (0)
ans =
Map with properties:
Count: 1
KeyType: char
ValueType: double
>> myfunc2 (1)
ans =
Map with properties:
Count: 1
KeyType: char
ValueType: double
Regards,
Richard
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.