Page 1 of 1

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

Posted: Mon May 21, 2018 10:38 am
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.

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

Posted: Mon May 21, 2018 11:24 am
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.

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

Posted: Mon May 21, 2018 2:31 pm
by tomfid
You could use VECTOR SELECT, which has an argument for missing values.

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

Posted: Mon May 21, 2018 2:44 pm
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.

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

Posted: Tue May 22, 2018 6:16 am
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

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

Posted: Tue May 22, 2018 9:53 am
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.