[Scilab-users] Inserting %nan at given positions into a vector

Jens Simon Strom j.s.strom at hslmg.de
Wed Dec 5 13:01:26 CET 2018


Hallo Scilab experts,
Given is a numeric vector x of length n and an index vector i with 
max(i)=n. I want to insert a %nan after every x(i).

Example
x=[11:20]
i=[2 5 8]
Required result: y=[11 12 %nan 13 14 15 %nan 16 17 18 %nan 19 20]

How would you proceed so that it works fast for n>500000 too.

Kind regards

Jens


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20181205/abdb90df/attachment.htm>


More information about the users mailing list