LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filling N dimentional array without for loop

Solved!
Go to solution

@ziedhosni wrote:

I am trying to calculate f(x1,x2...,xn) of the Ackley function that can be of any dimensions.

http://www.sfu.ca/~ssurjano/ackley.html

I am trying to calculte xi for a grid of 10 or customisable for each dimension.

 


 

 

You are overthinking all this! Please take a step back....

 

Arrays of any dimension are just a long series of 1D elements in memory, with a header giving the size in each dimension. For utmost flexibility, just use a 1D array instead and do the math assigning elements to any particular point in N dimensions yourself. (Q&R comes in handy!). It is trivial math to convert between multidimensional indices to 1D indices (and back!). LabVIEW does for you when using higher dimension arrays, but you can equally well do yourself.

 

This is also more useful for fitting, for example, because the stock fit functions only accept 1D arrays. Simply fit the entire data pile as a flattened 1D array!

 

It is dificult to display data with more than 3 dimension anyway, so once you have that 1D array containing all elements. You can create costom tools to extract slices or planes of lower dimension for display.

 

Just try it! 😄

0 Kudos
Message 21 of 23
(1,095 Views)

Altenbach, check out the lvproj I put together; it does just this 🙂

0 Kudos
Message 22 of 23
(1,093 Views)

@ijustlovemath wrote:

Altenbach, check out the lvproj I put together; it does just this 🙂


Ah OK. I haven't looked at it yet. Just woke up! 😄

0 Kudos
Message 23 of 23
(1,091 Views)