n-dimensional array variables

Moderator: Benj

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 68 times
Been thanked: 27 times
Contact:

n-dimensional array variables

Postby Mantas » Sat Aug 25, 2012 3:29 pm

Hello MM,

It was several times for me when I encountered limitations of Flowcode which allows to create only 1-dimensional array variable, like variable_array[i]. I would love to be able to create a two or even three dimensional array variables for calculation which require matrices (for example Euler angle, or Quaternion calculations), like 2-dimensional variable_array[i][j]. Finally you are MATRIX multimedia :D I would find this to be very useful, and would expand flowcode capabilities. And I think it is not a very big change, programming wise.

Best regards,
Mantas
Science is my true religion.

IVL
Posts: 17
Joined: Sat Sep 17, 2011 7:10 pm
Location: Belgium
Has thanked: 8 times
Been thanked: 5 times
Contact:

Re: n-dimensional array variables

Postby IVL » Sat Aug 25, 2012 3:41 pm

Hi,

You might be interested to take a look at this post :

http://www.matrixmultimedia.com/mmforums/viewtopic.php?f=46&t=10586&p=37105&hilit=benj+dspic#p37105

Regards,
Ivan

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: n-dimensional array variables

Postby Enamul » Sat Aug 25, 2012 4:07 pm

Hi Mantas,
I can make something using Sean's concept..
viewtopic.php?f=36&t=4869&p=35962&hilit=2D+array#p35962
If you want...
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: n-dimensional array variables

Postby Enamul » Sat Aug 25, 2012 5:59 pm

HI Mantas,
After spending 1 hour, I have manged to make 2D array without c code using the 1D array. you can use that as normal 2D array. In the example code, I have 2 macro for write to and read from array. I have to take pre-caution as array starts at 0 index. And need to consider problem in reading location like (1,2) and (2,1) are different..

In the beginning of the code you will see Array_row and Array_column which will determine your 1D array size and also 2D array indexes. So be-careful in using 2D array as I have declared the string (1D array) with size 40. So you can use row*column max 40 but you can edit that to increase. In the example, you can write data using row and column index (remember for 0 as start ) in the write macro and can retrieve that using the read macro..
Hope that will be useful..
Attachments
2DArray.fcf
(13.59 KiB) Downloaded 180 times
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 68 times
Been thanked: 27 times
Contact:

Re: n-dimensional array variables

Postby Mantas » Sat Aug 25, 2012 8:41 pm

Hello Ivan and Enamul,


Also matrix and matrix manipulation features would be very useful.

Answer from Ben:
Agreed, I will think up a way to get this in.


This sounds promising, i think it would be great to get that in the 5.4 update for ARM.

Enamul, as you saw, I have already posted in Seans article, and it works, but only if you want to store constants, but then reaching them is a pain in the ass. I managed to finish my complex SPA project using 3 dimensional arrays, in the supplementary code, but I had in mind matrix manipulations, as quoted above. Yes your program works, but it is too much of a hassle, and if you wanted to make complex mathematical operations like matrix operations, you would put a huge burden on your shoulders, while trying to complete such calculations like for example the Eulers angles or quaternions. It would be nice to have a native support for matrices. Anyway, thanks for your input making this program, I think someone might find it useful :)

Best regards,
Mantas
Science is my true religion.

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 68 times
Been thanked: 27 times
Contact:

Re: n-dimensional array variables

Postby Mantas » Sun Aug 26, 2012 8:20 pm

By the way, just wanted to add, that something like matrix operations in matlab would be very convenient.

Regards,
Mantas
Science is my true religion.