LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
ket

MathScript should handle more than 2 indices

Status: New

As of now Labview Mathscript can handle only 2 indices. for example:

Mathscript can execute the following

for i = 1:10

    for j = 1:10

        B(i,j) = i+j

    end

end

but it can't do the following:

for i = 1:10

    for j = 1:10

        for k = 1:10

            B(i,j,k) = i+j+k

        end

    end

end

 

I propose that Matscript should handle more than 2 indices.

The output then would be a 'n' dimensional array, where 'n' is the number of dummy indices.

1 Comment
EngrStudent
Active Participant

This should be a relatively simple thing to fix. 

 

A 2d array, when examined using assembler, is often a vector in memory, with two defining numbers that give current index and how many columns there are.  To go to a point (m,n) one really goes to index m*N_col+n.  This should be easily wrapper-ed to allow larger wrapper-ings: point (p,q,r) is found by going to vector index p*N_col*N_row+q*N_col + r while point (i,j,k,m) is found by going to vector index i*N_cell_per_block+j*N_cell_per_sheet+k*N_cell_per_row+m.