Hi,
When using VECTOR ELM MAP function, would it be possible to avoid the error message (due to mapping outside the range) and set those :NA: to be some value such as 0? Basically I want to "shift" the values of a subscripted constant A to a subscripted constant B, by 5 subscript units. Something like the following:
A [00] = 0.1
A [01] = 0.2
A [03] = 0.3
A [04] = 0.4
A [05] = 0.5
A [06] = 0.6
A [07] = 0.7
A [08] = 0.8
A [09] = 0.9
...
A [99] = 9.9
A [100] = 10
By using VECTOR ELM MAP, with the offset being -5, I want to have:
B [00] = 0
B [01] = 0
B [03] = 0
B [04] = 0
B [05] = 0
B [06] = 0.1
B [07] = 0.2
B [08] = 0.3
B [09] = 0.4
...
B [99] = 9.4
B [100] = 9.5
The shift works out for B [06] to B [100]. However, error messages showing "ERROR: VECTOR_ELM_MAP outside array bounds computing..." come up, and the values for B [00] to B [05] are "--" instead of 0.
It is not surprising that the error message come up, because there are no subscripts before [00]. But is it possible to somewhat suppress the error messages and assign 0 to B [00] to B [05] ?
Finally, is VECTOR ELM MAP the best method in this case? Wondering whether there is some other way that is more efficient/elegant.
Thank you so much.
VECTOR ELM MAP - how to avoid error messages and set NA to 0?
-
- Senior Member
- Posts: 105
- Joined: Wed Oct 25, 2017 3:52 pm
- Vensim version: PRO
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: VECTOR ELM MAP - how to avoid error messages and set NA to 0?
You cannot suppress the error (as it is an error).
One alternative would be to do something like I've done in the attached model.
One alternative would be to do something like I've done in the attached model.
- Attachments
-
- demo.mdl
- (1.91 KiB) Downloaded 200 times
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: VECTOR ELM MAP - how to avoid error messages and set NA to 0?
You could use VECTOR SELECT, which has an argument for missing values.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 105
- Joined: Wed Oct 25, 2017 3:52 pm
- Vensim version: PRO
Re: VECTOR ELM MAP - how to avoid error messages and set NA to 0?
Thanks a lot Administrator. Please could you explain why a Sum function is needed here?
Thanks.
Thanks.
Administrator wrote:You cannot suppress the error (as it is an error).
One alternative would be to do something like I've done in the attached model.
Re: VECTOR ELM MAP - how to avoid error messages and set NA to 0?
Hi
go to
viewtopic.php?f=2&t=3192&p=22055&hilit= ... map#p22055
it will ho to avoid using the tricky and Dangerous vector elm map function.
Regards.
JJ
go to
viewtopic.php?f=2&t=3192&p=22055&hilit= ... map#p22055
it will ho to avoid using the tricky and Dangerous vector elm map function.
Regards.
JJ
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: VECTOR ELM MAP - how to avoid error messages and set NA to 0?
It's only there to loop over the whole subscript range.WayneZhou2009 wrote:Thanks a lot Administrator. Please could you explain why a Sum function is needed here?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559