IDL Beginner exercise help [message #93731] |
Mon, 10 October 2016 19:49  |
smnadoum
Messages: 24 Registered: June 2016
|
Junior Member |
|
|
Hi,
I am an IDL beginner. This is my first assignment, but I am stuck. Anyone can help?
1)Create a variable containing your first and last name. Then name the variable A.
2)output the content of variable A.
3)what kind of variable is A?
Thanks
|
|
|
|
|
Re: IDL Beginner exercise help [message #93746 is a reply to message #93732] |
Tue, 11 October 2016 17:00   |
smnadoum
Messages: 24 Registered: June 2016
|
Junior Member |
|
|
On Tuesday, October 11, 2016 at 2:43:02 AM UTC-7, Markus Schmassmann wrote:
> On 10/11/2016 04:49 AM, Cheryl wrote:
>> I am an IDL beginner. This is my first assignment, but I am stuck. Anyone can help?
>>
>> 1)Create a variable containing your first and last name. Then name the variable A.
>> 2)output the content of variable A.
>> 3)what kind of variable is A?
> IDL> A='Cheryl Smnadoum'
> IDL> print, A
> Cheryl Smnadoum
> IDL> help, A
> A STRING = 'Cheryl Smnadoum'
> IDL> size(A,/tname)
> STRING
Can I ask you one more question:)?
How to create a 4 by 3 integer array that counts from 10 to 21?
C= INTARR(4,3) ; this is an integer array of two dimensions
but how do I write it with [10:21]?
Thank you
|
|
|
|
Re: IDL Beginner exercise help [message #93749 is a reply to message #93747] |
Wed, 12 October 2016 00:35  |
Yngvar Larsen
Messages: 134 Registered: January 2010
|
Senior Member |
|
|
Or
IDL> indgen(4,3, start=10)
10 11 12 13
14 15 16 17
18 19 20 21
which strictly speaking does not answer the specific question by not using [10:21], but has the same answer :)
PS: since OP is a beginner, I might point out that it is in general not a good idea to work with INTARR/INDGEN since the 16-bit integers these create, quickly will bite you with overflow problems. LONARR/LINDGEN (32-bit integers) should be a better default choice unless you are 100% certain that your data and the operations applied on them will fit in the interval [-32768,32767].
On Wednesday, 12 October 2016 03:13:01 UTC+2, wlandsman wrote:
> One way is
> IDL> a = reform( [10:21], 4,3)
>
> where REFORM reshapes your 12 element vector into a 4 x 3 array.
>
> On Tuesday, October 11, 2016 at 8:00:33 PM UTC-4, Cheryl wrote:
>
>>
>> Can I ask you one more question:)?
>>
>> How to create a 4 by 3 integer array that counts from 10 to 21?
>> C= INTARR(4,3) ; this is an integer array of two dimensions
>> but how do I write it with [10:21]?
>>
>> Thank you
|
|
|