For above code,
We can use Constant block to generate x and then save corresponding y values using To Workspace block based on condition using Switch block
You can also use input and outport but donot keep the port in loop. Fetch all the data once and start processing the data
As an example I am attaching the model
Also if you want data to be taken in serial then use Unbuffer block after the constant block