VECTOR ELM MAP - how to avoid error messages and set NA to 0?

Use this forum to post Vensim related questions.
Post Reply
WayneZhou2009
Senior Member
Posts: 105
Joined: Wed Oct 25, 2017 3:52 pm
Vensim version: PRO

VECTOR ELM MAP - how to avoid error messages and set NA to 0?

Post by WayneZhou2009 »

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.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: VECTOR ELM MAP - how to avoid error messages and set NA to 0?

Post by Administrator »

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.
Attachments
demo.mdl
(1.91 KiB) Downloaded 197 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
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: VECTOR ELM MAP - how to avoid error messages and set NA to 0?

Post by tomfid »

You could use VECTOR SELECT, which has an argument for missing values.
WayneZhou2009
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?

Post by WayneZhou2009 »

Thanks a lot Administrator. Please could you explain why a Sum function is needed here?

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.
LAUJJL
Senior Member
Posts: 1421
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: VECTOR ELM MAP - how to avoid error messages and set NA to 0?

Post by LAUJJL »

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
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: VECTOR ELM MAP - how to avoid error messages and set NA to 0?

Post by Administrator »

WayneZhou2009 wrote:Thanks a lot Administrator. Please could you explain why a Sum function is needed here?
It's only there to loop over the whole subscript range.
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
Post Reply