Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sun Oct 21, 2018 8:42 pm

All times are UTC - 7 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Aug 11, 2011 7:35 am 

Joined: Wed Aug 03, 2011 8:44 am
Posts: 7
I need to create a matrix of integers (or floats) which I'd like to define as 2-dimensional array. How can I declare it in Qlarity ?

I tried it like

dim arr[3][3] as integer  ' or as float

but the compiler didn't liked in :-(

In the documentation, there's nothing mentioned about more-dimensional arrays.

How can I go on ?

Tony :-)

PostPosted: Mon Aug 15, 2011 6:57 am 
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Unfortunately, Qlarity does not support multi-dimensional arrays. It is high on the list of features I would like to implement, however it is an extremely invasive change which is why we haven't done it yet.

For a rectangular matrix, the simplest solution is usually to use a single dimensional array and manually calculate the index. Such as

dim arr[9] as integer
dim x, y, idx as integer
dim value as integer
x := 1
y := 2
idx := 3*y + x
value = arr[idx]

For more complicated scenarios (jagged arrays, arrays of strings etc), there are some other Qlarity options that are more useful. This includes: "String Arrays" (in quotes because it is simulated) and the AllocateArrayHandle family of functions to reduce an array to a scalar value for storage into a linear array.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group