<< Chapter < Page Chapter >> Page >
The creation of this content was supported in some part by NSF grant 0538934.

To create an array in G, right click on the Front Panel window and select Array from the Controls>>Modern>>Arrays, Matrix&Cluster menu, and drop the array structure onto the Front Panel window to create an array.

An array structure. The top level listing of the array is labeled Modern and underneath that level is Array, Matrix & Cluster. This level is identified by two icons in a gray shaded rectangle. The icon on the left is labeled Array and the icon on the right is labeled Cluster.
Array Structure

The array structure consists of an index or element offset (highlighted left portion of the array structure) and the array elements (right portion of the structure). When the array structure is placed on the Front Panel window, the data type of the array is undefined as indicated by the grayed out portion of the array.

A screen capture showing up and down arrow buttons to the left of field containing the number 0. The arrow buttons and the field containing the number 1 are contained within a red square box labeled index. These elements are the upper left of a square labeled Elements.
Index and Elements of an Array

To define the array data type, drag and drop any data type, such as numeric, Boolean, string or cluster structure, onto the elements portion of the array structure.

An array field screen capture.
Creating Arrays

At this point, the newly defined array is an Empty or Null Array because no elements of the array have been defined. This is indicated by the grayed out data type within the elements array structure.

A form labeled 'Array' with two fields. each field contains the value '0'.
Empty Arrays

To define elements of an input array, select the element’s index and enter the appropriate value. [link] defines a numeric array with one element at index 0.

A form labeled 'Array' with two fields. The left field contains the value '0' and the right field contains '1.2345'.
Defining Array Elements

G arrays are zero-based. The last element index of an N element array is N-1 . [link] and [link] are those of a 10 element array.

A form labeled 'Array' with two fields. The left field contains the value '9' and the right field contains '9.1011'.
Last Array Element
A form labeled 'Array' with two fields. The left field contains the value '10' and the right field contains '0'.
Undefined Nth Element

An output array is created similarly to an input array with the exception that an output data type needs to be dropped into the array structure.

A form with two sets of two fields. The left form is labeled 'Numeric Input Array' with the values '0' and '0'. The right form is labeled 'Numeric Output Array' with both values being '0'.
Input and Output Arrays

Multidimensional arrays

To create multidimensional arrays, click on the array’s index and select Add Dimension from the menu.

[link] shows a 2-dimensional array.

An array form overlaid with a menu. The item 'Add Dimension' is highlighted in blue.
Creating Multidimensional Arrays
An array form with three fields. The values are '9', '9.1' and '1'.
Multidimensional Array

Array operators

A 4x7 table of icons contained under the direcotry levels 'Programming' and 'Array'.
Array Operators

Clusters

Clusters allow users to create compound data types by aggregating various and different data types into a single unit.

An empty cluster field.
Empty Cluster

Select the various data types and drag them onto the cluster structure. [link] shows an Error Cluster consisting of a Boolean Error , a numeric ID and a string Message data types.

An error cluster field with a green circle labeled 'Error'  and a field labeled 'ID' containing '2', and the last field is labeled 'Message' with the value 'Out of range'.
Cluster Example

Cluster operators

A 3x6 table of icons contained within the directory levels 'Programming'  and  'Cluster, Class, and Variant'.
Cluster Operators

Questions & Answers

anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
China
Cied
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Berger describes sociologists as concerned with
Mueller Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Introduction to g programming. OpenStax CNX. Mar 15, 2010 Download for free at http://cnx.org/content/col11192/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Introduction to g programming' conversation and receive update notifications?

Ask