Hi, I'm trying to assign a variable to the output of a solve block but there vector inputs and the output from the 'find' function is a series of 2x1 arrays, in one long array. Sorry - it's hard to describe but an image is attached.
I've created two blocks to show the problem - the last one showing the error when I want to assign the output to a variable.
The problem is that you are not dealing with vectors when you make your reault dependent on a range i. The result of your left solve block is NOT a nested vector and so you can't assign it a variable or access a single element of it.
A possible solution might be the following:
Delete the definition of the range i
At the end of the solve block use
Solution(i):=Find(c,y)
below the solve block define your range i:=0..11 and use
Out[i:=Solution(i)
This should do the job. "Out[i" means you use variable "Out" with vector index "i"
I guess that turning the solve block into a function of i is exactly what I sugested, isn't it??
With the exection that you did not assign the result to a variable, as demanded.
In fact with your approach you have the same problem as Boyd experienced - you can't assign Out(i) to a variabe because the result still is not a true nested vector.
Only way without changing too much seems to be to write something like FinalOut[i:=Out(i) as I sugested.
The better way in my opinion (requires a bit more changes) would be to turn the solve block into a function with six arguments (representing the values of the six array used) and so get rid of the index i altogether Then this function would be called vectorized with the six arrays as argument.
Here is a Pic of a simplified expamlple which hopefully clarifies what I am talking about:
Thanks for the input. Unfortunately I'm having laptop issues so am unable to make adjustments until Monday. I had already tried the vectorised version and as I recall it was taking forever to solve because my input vectors are going to be about 10000 elements long. The other option (right hand) looks like it might work other than I would prefer two separate arrays (one for x and other for y) but I guess I can do that after? Thanks again