comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL Beginner exercise help
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL Beginner exercise help [message #93731] Mon, 10 October 2016 19:49 Go to next message
smnadoum is currently offline  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 #93732 is a reply to message #93731] Tue, 11 October 2016 02:42 Go to previous messageGo to next message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
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
Re: IDL Beginner exercise help [message #93745 is a reply to message #93732] Tue, 11 October 2016 16:09 Go to previous messageGo to next message
smnadoum is currently offline  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

Thank you very much.
Re: IDL Beginner exercise help [message #93746 is a reply to message #93732] Tue, 11 October 2016 17:00 Go to previous messageGo to next message
smnadoum is currently offline  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 #93747 is a reply to message #93746] Tue, 11 October 2016 18:12 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
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
Re: IDL Beginner exercise help [message #93749 is a reply to message #93747] Wed, 12 October 2016 00:35 Go to previous message
Yngvar Larsen is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ncdf_varput for NetCDF coordinate axes
Next Topic: How to supress dialog popup when netcdf file is corrupt?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 09:15:02 PDT 2025

Total time taken to generate the page: 0.00698 seconds