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

Home » Public Forums » archive » Re: sort arrays based on names
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
Re: sort arrays based on names [message #71369] Thu, 17 June 2010 13:04 Go to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jun 17, 4:39 pm, Hassan <hkhav...@gmail.com> wrote:
> when I use Sort() it returns me integer values instead of sorting
> strings.

sort() gives the indexes of the elements in the order that would make
the array sorted. That is:

s=sort(a) ;Finds the sort order for array a
b=a[s] ;b is a sorted
Re: sort arrays based on names [message #71373 is a reply to message #71369] Thu, 17 June 2010 12:39 Go to previous messageGo to next message
Hassan is currently offline  Hassan
Messages: 48
Registered: October 2009
Member
when I use Sort() it returns me integer values instead of sorting
strings.
Re: sort arrays based on names [message #71385 is a reply to message #71373] Thu, 17 June 2010 04:52 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jun 17, 5:24 am, Hassan <hkhav...@gmail.com> wrote:
> actually I have many arrays nearly 100 that I want to put them in one
> big array in order based on the name and wanted to know if there is a
> simple way to do it.

You should not have so many arrays to begin with. Whatever was put
into them should have gone into the single array at the beginning.
That is what multidimensional arrays and arrays of pointers are for.
Re: sort arrays based on names [message #71386 is a reply to message #71385] Thu, 17 June 2010 04:43 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jun 17, 5:41 am, Hassan <hkhav...@gmail.com> wrote:
> I wonder how I can sort a vector of names (which include letters,
> numbers, slash,...)?

Same as numbers, with sort.
Re: sort arrays based on names [message #71390 is a reply to message #71386] Thu, 17 June 2010 01:41 Go to previous messageGo to next message
Hassan is currently offline  Hassan
Messages: 48
Registered: October 2009
Member
I wonder how I can sort a vector of names (which include letters,
numbers, slash,...)?
Re: sort arrays based on names [message #71392 is a reply to message #71390] Thu, 17 June 2010 01:24 Go to previous messageGo to next message
Hassan is currently offline  Hassan
Messages: 48
Registered: October 2009
Member
actually I have many arrays nearly 100 that I want to put them in one
big array in order based on the name and wanted to know if there is a
simple way to do it.
Re: sort arrays based on names [message #71396 is a reply to message #71392] Wed, 16 June 2010 23:54 Go to previous messageGo to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Jun 16, 3:30 pm, Hassan <hkhav...@gmail.com> wrote:
> Hi,
> I have five arrays (ns=10,nl=20)  with the following names:
> c:\test\red1.img
> c:\test\red10.img
> c:\test\red2.img
> c:\test\red11.img
> c:\test\red3.img
> I want to make a new file which containes all files but in order like:
> new_array=(10,20,5)
> (following expression just show that I want to have the first image in
> the first layer of my new array)
> new_array(*,*,0) =c:\test\red1.img
> new_array(*,*,1)=c:\test\red2.img
> new_array(*,*,2)=c:\test\red3.img
> new_array(*,*,3)=c:\test\red10.img
> new_array(*,*,4)=c:\test\red11.img
>
> Any help please?

big=make_array(10,20,5)
big[*,*,0]=red1
big[*,*,1]=red2
big[*,*,2]=red3
……..
Re: sort arrays based on names [message #71458 is a reply to message #71369] Fri, 18 June 2010 04:58 Go to previous message
Hassan is currently offline  Hassan
Messages: 48
Registered: October 2009
Member
thanks a lot.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: SAVE compress and Gzip
Next Topic: recursive FILE_SEARCH in a symbolic link ?

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

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

Total time taken to generate the page: 0.00718 seconds