Go Down

### Topic: 3D look up tables possible? (Read 1 time)previous topic - next topic

#### jtw11

##### Oct 13, 2012, 11:58 pm
I have a need at the moment for a variable that is looked up from a 3D table, I can't say I know about how to use arrays - so I'm not sure if using arrays is the way to go about it, or if indeed a 3 dimensional array is possible.

How would I go about creating and using a lookup table? Size wise, I'm hoping to be able to use a table with a size of roughly 10 x 20.

Furthermore, these values will need to be interpolated between table cells - but we'll deal with that later...

#### AWOL

#1
##### Oct 14, 2012, 12:00 am
Quote
Size wise, I'm hoping to be able to use a table with a size of roughly 10 x 20.

That's 2D
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

#### nickgammon

#2
##### Oct 14, 2012, 12:02 am

I can't say I know about how to use arrays ...

You could Google "c++ array table".

I found around 23,000,000 hits. The first pageful was about multi-dimensional arrays.
Please post technical questions on the forum, not by personal message. Thanks!

#### jtw11

#3
##### Oct 14, 2012, 12:06 am

Quote
Size wise, I'm hoping to be able to use a table with a size of roughly 10 x 20.

That's 2D

Of course! I was thinking of the values in the table as being the "third" dimension... No wonder all the 3D info I've looked at seems to be over complicated so far.

#### dhenry

#4
##### Oct 14, 2012, 12:44 am
You can have as many dimensions as you want. End of the day, they are represented as a linearly addressed array.

So all it takes is for you to decide how you want to store / address the data, and retrieve accordingly.

#### robtillaart

#5
##### Oct 14, 2012, 03:58 pm

10x20 => 200 entries in your table. Is every entry a byte, int, long or float? Be aware that the amount of RAM is limited in Arduino's (depends on which you use) and if the array is readonly you might consider put it in program space (google PROGMEM).

Also if the array contains a lot of the same values you might consider using sparse array's. See - http://en.wikipedia.org/wiki/Sparse_matrix -
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

#### jtw11

#6
##### Oct 15, 2012, 05:29 pm
I will look through this, thank you - the arrays will be read only yes.

Go Up