f



sort and get index?

In matlab, the sort function returns two things:

[a,b]=sort([5, 8, 7])

a = 5     7     8
b = 1     3     2

where a is the sorted result, and b is the corresponding index.
Is there C++ code available to achieve this?
Better compatible with STL vector.
Thanks
0
b83503104 (212)
5/20/2004 11:06:52 PM
comp.lang.c++ 49423 articles. 7 followers. Post Follow

8 Replies
1638 Views

Similar Articles

[PageSpeed] 55

"b83503104" <b83503104@yahoo.com> wrote...
> In matlab, the sort function returns two things:
>
> [a,b]=sort([5, 8, 7])
>
> a = 5     7     8
> b = 1     3     2
>
> where a is the sorted result, and b is the corresponding index.
> Is there C++ code available to achieve this?

Probably.  You could simply sort pairs based on their 'first'
members, then get the 'second' members (which you should set
to ordinal numbers before sorting).

V


0
v.Abazarov (13256)
5/21/2004 5:04:27 AM
template<class T> struct index_cmp {
	index_cmp(const T arr) : arr(arr) {}
	bool operator()(const size_t a, const size_t b) const
	{ return arr[a] < arr[b]; }
	const T arr;
};

vector<int> a;
a.push_back(5); a.push_back(8); a.push_back(7);

vector<size_t> b;
for (unsigned i = 0; i < a.size(); ++i)
	b.push_back(i);
// b = [0, 1, 2]
sort(b.begin(), b.end(), index_cmp<vector<int>&>(a));
// b = [0, 2, 1]

then just offset into the a vector with the indices in b. I recomend
just sorting the indices this way and not touching the a vector.
-1
5/21/2004 1:59:58 PM
b83503104@yahoo.com (b83503104) wrote in message 

> In matlab, the sort function returns two things:
> 
> [a,b]=sort([5, 8, 7])
> 
> a = 5     7     8
> b = 1     3     2
> 
> where a is the sorted result, and b is the corresponding index.
> Is there C++ code available to achieve this?
> Better compatible with STL vector.
> Thanks

There is no such way in C++.  But you can build it yourself.

Here is one suggestion: make your original vector { 5, 8, 7 }, make a
vector of pointers { &orig[0], &orig[1], &orig[2] }, sort the vector
of pointers using std::sort of 3 arguments which should yield {
&orig[0], &orig[2], &orig[1] }.

A second suggestion is: make your original vector a vector of
pair<int, index> as {  {5,0}, {8,1}, {7,2} }, sort the vector using
std::sort of 3 arguments which should yield { {5,0}, {7,2}, {8,1} }.

The first way would look something like this:

std::vector<int> orig;
orig.push_back(5);
orig.push_back(7);
orig.push_back(8);
std::vector<const int *> pointer;
pointer.reserve(orig.size());
const int *const start = &orig[0];
const int *const end =  start + orig.size();
for (int * iter = start; iter != end; ++iter) pointer.push_back(iter);
std::sort(pointer.begin(), pointer.end(), LessDereference());

where

struct LessDereference {
   template <class T>
   bool operator()(const T * lhs, const T * rhs) const {
      return *lhs < *rhs;
   }
};

To print the results, choose whatever option you want.  There are many
ways, and here is one:

for (int i=0; i<pointer.size(); i++) {
   const int * p = pointer[i];
   cout << "(" << *p << "," << p-start << " ";
}
0
namespace (24)
5/21/2004 5:06:44 PM
b83503104@yahoo.com (b83503104) wrote in message 

> In matlab, the sort function returns two things:
> 
> [a,b]=sort([5, 8, 7])
> 
> a = 5     7     8
> b = 1     3     2
> 
> where a is the sorted result, and b is the corresponding index.
> Is there C++ code available to achieve this?
> Better compatible with STL vector.
> Thanks

There is no such way in C++.  But you can build it yourself.

Here is one suggestion: make your original vector { 5, 8, 7 }, make a
vector of pointers { &orig[0], &orig[1], &orig[2] }, sort the vector
of pointers using std::sort of 3 arguments which should yield {
&orig[0], &orig[2], &orig[1] }.

A second suggestion is: make your original vector a vector of
pair<int, index> as {  {5,0}, {8,1}, {7,2} }, sort the vector using
std::sort of 3 arguments which should yield { {5,0}, {7,2}, {8,1} }.

The first way would look something like this:

std::vector<int> orig;
orig.push_back(5);
orig.push_back(7);
orig.push_back(8);
std::vector<const int *> pointer;
pointer.reserve(orig.size());
const int *const start = &orig[0];
const int *const end =  start + orig.size();
for (int * iter = start; iter != end; ++iter) pointer.push_back(iter);
std::sort(pointer.begin(), pointer.end(), LessDereference());

where

struct LessDereference {
   template <class T>
   bool operator()(const T * lhs, const T * rhs) const {
      return *lhs < *rhs;
   }
};

To print the results, choose whatever option you want.  There are many
ways, and here is one:

for (int i=0; i<pointer.size(); i++) {
   const int * p = pointer[i];
   cout << "(" << *p << "," << p-start << " ";
}
0
namespace (24)
5/21/2004 5:08:04 PM
anti_spam_email2003@yahoo.com (Me) wrote in message 

> template<class T> struct index_cmp {
> 	index_cmp(const T arr) : arr(arr) {}
> 	bool operator()(const size_t a, const size_t b) const
> 	{ return arr[a] < arr[b]; }
> 	const T arr;
> };

Maybe class index_cmp could hold a const reference rather than an
object (ie. change const T arr to const T& arr).  Saves unnecessary
copying.
 
> sort(b.begin(), b.end(), index_cmp<vector<int>&>(a));

You can provide rename index_cmp to index_cmp_t and provide an inline
function

template <class Container>
inline
index_cmp_t<Container>
index_cmp(const Container& c)
{
   return index_cmp_t<Container>(c);
}

This prevents the need to explicitly qualify template parameters in
the code.
0
namespace (24)
5/21/2004 8:52:12 PM
"b83503104" <b83503104@yahoo.com> wrote in message
news:73830d2d.0405201506.216db65f@posting.google.com...
> In matlab, the sort function returns two things:
>
> [a,b]=sort([5, 8, 7])
>
> a = 5     7     8
> b = 1     3     2
>
> where a is the sorted result, and b is the corresponding index.
> Is there C++ code available to achieve this?
> Better compatible with STL vector.
> Thanks

Try the following untested code after installing boost from www.boost.org.

#include <map>
#include <boost/bind.hpp>
#include <boost/iterator/counting_iterator.hpp>

typedef std::map<int,int> tMap; // <data,index>

tMap Map;

int Data[] = { 5, 8, 7 };

std::transform( &data[0], &data[3]
              , boost::counting_iterator<int>(1)
              , std::inserter<tMap>(Map)
              , boost::bind( std::make_pair<int,int>, _1, _2 )
              );

for( tMap::const_iterator lItr = Map.begin() ; lItr != Map.end() ; ++lItr )
{
    std::cout << "Data Value: " << lItr->first
              << " At Index: "  << lItr->second;
}

Jeff F


0
NONONE (273)
5/21/2004 9:22:30 PM
> Maybe class index_cmp could hold a const reference rather than an
> object (ie. change const T arr to const T& arr).  Saves unnecessary
> copying.
>  
> > sort(b.begin(), b.end(), index_cmp<vector<int>&>(a));

It does hold a const reference (notice the '&' at the call to sort). I
did it this way because doing it the way I would do in real life (add
a reference only if T isn't a pointer or a reference) requires a lot
more code or a dependency on boost's type_traits (which will hopefully
be added to the next standard).
0
5/22/2004 4:06:33 AM
anti_spam_email2003@yahoo.com (Me) wrote in message 

> > Maybe class index_cmp could hold a const reference rather than an
> > object (ie. change const T arr to const T& arr).  Saves unnecessary
> > copying.
> >  
> > > sort(b.begin(), b.end(), index_cmp<vector<int>&>(a));
> 
> It does hold a const reference (notice the '&' at the call to sort). I
> did it this way because doing it the way I would do in real life (add
> a reference only if T isn't a pointer or a reference) requires a lot
> more code or a dependency on boost's type_traits (which will hopefully
> be added to the next standard).

Good point, sorry missed it.
0
namespace (24)
5/22/2004 3:53:12 PM
Reply:

Similar Artilces:

Better C/C++ Than C/C++?
I am looking for a good systems programming language that can be used instead of C/C++. My qualifications for the language are: * mature compiler(s) that produce native-code binaries (for Windows) * open source - preferable, but not 100% necessary Thanks, Kevin "Kevin Albrecht" <kevin@albrecht.net> writes: > I am looking for a good systems programming language > that can be used instead of C/C++. My qualifications > for the language are: > > * mature compiler(s) that produce native-code > binaries (for Windows) Ocaml, D, cyclone, Eiffel, Beta > * open source - preferable, but not 100% necessary what's wrong with using C? Friedrich > what's wrong with using C? Too low level, no built-in garbage collection. -- Kevin "Kevin Albrecht" <kevin@albrecht.net> writes: >> what's wrong with using C? > > Too low level, Well the Smalltalk people say, have a small language and a big library. I assume C's library status beyond that of Smalltalk. > no built-in garbage collection. Use the Boehm Weisser GC. Friedrich "Kevin Albrecht" <kevin@albrecht.net> wrote in message news:<2TiYb.237892$rj7.1641209@twister.tampabay.rr.com>... > I am looking for a good systems programming language > that can be used instead of C/C++. My qualifications > for the language are: > > * mature compiler(s) that produce native-code > binaries (for Windows) > ...

get what is not equal in a.c to b.c
How come this one works SELECT DISTINCT a.d FROM a,b WHERE a.c NOT IN (SELECT b.c FROM b) but this one doesn't SELECT DISTINCT a.d,a.c FROM a LEFT JOIN b USING (c) WHERE a.c<>b.c I'm trying to get the rows in a.c that don't match b.c but the 2nd one should be faster. thanks, Janis TABLE A TABLE B col d col c col c ____________ ____________ 1 apple apple 2 banana kiwi 3 orange banana 4 grapefruit blackberry 5 cherry persimmon 6 N...

Where to get a compatibility list of C and C++?
Hi, all! I'm looking for a list of features that are supported in C but not supported in C++. I also need the complete list of language alterations from K&R C to C89 then to C99. Would anyone help? Thanks! Aladdin On 25 Jul 2005 18:44:11 -0700, "Aladdin" <buaa_aladdin@163.com> wrote in comp.lang.c: > Hi, all! > > I'm looking for a list of features that are supported in C but not > supported in C++. I also need the complete list of language alterations > from K&R C to C89 then to C99. > > Would anyone help? Thanks! > > Aladdin ...

Just getting started in C++, C+
Thanks in advance to all of you, Your recommendations: What kind of instruction and software are needed to learn and do useful programming using C+, C++ ? I would like to access and use the windows graphics environment. SRabin, > What kind of instruction and software are needed to learn and do useful > programming using C+, C++ ? There is nothing like C+. A good tutorial: http://www.cplusplus.com/doc/tutorial/ > I would like to access and use the windows graphics environment. Free: DevC++ (core c++, that black command line window) + WxWidgets (for graphical user interfaces) C...

How to get signed zeros in C++/C?
I don't find how to express signed zeros in C++/C. Does anybody know what is the proper way to do so? Are they just -0.0 and +0.0? How to distinguish signed zeros from true zeros. http://en.wikipedia.org/wiki/Signed_zero Regard, Peng Peng Yu <pengyu.ut@gmail.com> writes: > I don't find how to express signed zeros in C++/C. Does anybody know > what is the proper way to do so? Are they just -0.0 and +0.0? How to > distinguish signed zeros from true zeros. > > http://en.wikipedia.org/wiki/Signed_zero AFAIK there is no literal for those. You need to ...

What is faster? C++ vector sort or sort in database
I have to fetch values from a database and store them in a vector in my c++ application. What is faster? if i fetch the values sorted from the database with a 'order by' clause in the sql-statement or if i fetch them into the vector unsorted and sort the vector then? Thanx for your help Greetz Jens "JerryJ" <jerryj@gmx.de> wrote in message news:e9013551.0404240119.8a52dbf@posting.google.com... > I have to fetch values from a database and store them in a vector in > my c++ application. > > What is faster? if i fetch the values sorted from the database...

sorting list and then return the index of the sorted item
I need help sorting a list...I just can't figure out how to sort a list and then return a list with the index of the sorted items in the list for example if the list I want to sort is [2,3,1,4,5] I need [2,0,1,3,4] to be returned Can someone help please.... custard_pie wrote: > I need help sorting a list...I just can't figure out how to sort a list > and then return a list with the index of the sorted items in the list > for example if the list I want to sort is [2,3,1,4,5] > I need [2,0,1,3,4] to be returned http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/30686...

How To Accessing C++ Class objects in C : getting error fatal error C1189: #error : "eh.h is only for C++!"
hi , i am Getting this Error fatal error C1189: #error : "eh.h is only for C++!" my Problem is i am Having C++ librabry and Appropriate .h file i want to Access Them is .c File Files..... to Be More Specific i am Creating a C++ Object in a C file... this Giving me the error!!! :( can Any Body Please Help me How to Access the C++ object in C file... Thanks In Advance :) Hi, > How to Access the C++ object in C file... Please have a look at the following page http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html Regards On Jan 7, 11:17=A0am, "sachinv1...@gmail.com" <sachinv1...@gmail.com> wrote: > hi , > i am Getting this Error > fatal error C1189: #error : "eh.h is only for C++!" > my Problem is i am Having C++ librabry and Appropriate .h file > i want to Access Them is .c File Files..... > to Be More Specific i am Creating a C++ Object in a C file... > this Giving me the error!!! :( > > can Any Body Please Help me > > How to Access the C++ object in C file... > Thanks In Advance :) In general, you can't. You can provide a procedural interface instead, and declare it in a header file like this: #ifdef __cplusplus extern "C" { #endif void some_function(int, char*, double); // or whatever #ifdef __cplusplus } #endif This can then be included from both C and C++. On Jan 7, 4:32=A0pm, tragomaskhalos <dave.du.verg...@logicacmg.com> wrote: > On Jan 7, 11:17=A0am, "...

C/C++ in MATALB or MATLAB in C/C++?
Hi I've been asking on the net how to use MEX properly so that I can use C/C++ in MATLAB, but information is not forthcoming. There seems to be a lot on using MATLAB in C/C++ but not the other way around. I understand Mathworks is trying very hard to sell the Matlab Compiler, but even so, why is it SO hard to get information about MEX? Or is it that I've missed something very fundamental, meaning that I'm struggling over something that is actually quite easy? Any thoughts and info would be great. Thanks BullDog BullDog wrote: > Hi > > I've been asking on the net ...

C/C++ in matlab and matlab in C/C++ ?
Is it possible to read C/C++ code in matlab and the other way around too? Hi, as long as C or C++ are written in text files you can edit them in the matlab editor. To see the special character of C or C++ coding language, in the editor go to menus: file>preferences>Edito/Debugger>language and on popup "Language" select "C/C++". This does not allow you to run the C/C++ code, just to view it i nicer way... regards, chris saneman <asdfsdf@asd.com> wrote in message <frl846 $f8i$2@news.net.uni-c.dk>... > Is it possible to read C/C...

[Urgent]: How To Accessing C++ Class objects in C : getting error fatal error C1189: #error : "eh.h is only for C++!"
hi , i am Getting this Error fatal error C1189: #error : "eh.h is only for C++!" my Problem is i am Having C++ librabry and Appropriate .h file i want to Access Them is .c File Files..... to Be More Specific i am Creating a C++ Object in a C file... this Giving me the error!!! :( can Any Body Please Help me How to Access the C++ object in C file... Thanks In Advance :) "sachinv1821@gmail.com" <sachinv1821@gmail.com> writes: > How to Access the C++ object in C file... > Thanks In Advance :) You'd be better off asking in comp.lang.c++. I know this sounds...

[News] Linux Gets Bidirectional C/C++ Debugger
First C/C++ binaries bidirectional debugger targets Linux ,----[ Quote ] | Co-founder Julian Smith says Undo chose to release its bidirectional | debugger on Linux first because, "Today's Linux market is pretty | exciting, not least due to its rapid expansion into consumer | electronics and other embedded systems... `---- http://www.linuxdevices.com/news/NS4715550062.html ...

Get file url from file path with C/C++
Hi, Does anyone know how to get a file url (file://host/folder/...) from a path string? On Mac there is CFURL, but on windows I cannot find this kind of function. I looked at xerces, and couldn't find functionality either. The XMLURL looks like get the file path from file url. Thanks in advance. Henry Henry_c_sun@hotmail.com wrote: > Does anyone know how to get a file url (file://host/folder/...) from a > path string? Uhm... that isn't an XML question, it's a C++ library question. You'd probably get better and faster answers in a newsgroup dealing with programming in C++. -- () ASCII Ribbon Campaign | Joe Kesselman /\ Stamp out HTML e-mail! | System architexture and kinetic poetry ...

getting DDL for all indexes on a table (using dbms_metadata.get)
A table in a database has 146 columns and 76 indexes on it, most of the indexes are unused, I suspect. I'm not sure why, but most of these were (likely) from when developers had access to the database and were adding an index everytime they thought it might do some good. I want see which of these are being used at all, and drop the ones that aren't, but I want to generate the DDL for all the indexes on the table so if need be I can restore them. I used to use a tool (I think it was called DB Artisan or something like that) that would do this, but don't have it available anymore and in any case would just as soon learn the sql syntax for doing this. I have done some research on dbms_metadata.get and see how I can generate ddl for a specific table, but I want it to generate all the ddl for all indexes on a given table, is this possible? database is 9.2.0.7 thanks in advance On May 20, 4:10=A0pm, GS <G...@GS.com> wrote: > A table in a database has 146 columns and 76 indexes on it, most of the > indexes are unused, I suspect. =A0I'm not sure why, but most of these were= > (likely) from when developers had access to the database and were adding > an index everytime they thought it might do some good. =A0I want see which= > of these are being used at all, and drop the ones that aren't, but I > want to generate the DDL for all the indexes on the table =A0so if need be= > I can restore them. > > I used to use ...

C,, C++, Java, C#
I come from C,C++,Java and C#. What can SmallTalk do for me and for what cost? Regarding the Squeak thing, it's interesting though confusing. Is it an IDE? Why are the menus so wacky? "DM McGowan II" <nospam@nospam.net> wrote in message news:PLednX2vnLd11IncRVn-rA@comcast.com... > I come from C,C++,Java and C#. What can SmallTalk do for me ...? Ask not what Smalltalk can do for, but what can you do with Smalltalk. :-) In very few words, it significantly reduces time to market, while enhancig the development experience. This is because: 1. It manages the memory for you, so you don't have to allocate/deallocate all the time (the source of some of the most nasty bugs in C). Java and C# learnt that feature from ST. 2. It has single inheritance. 3. All the development is in a single file, called the image, so you don't have to fish for where did you put that missing class. Yet, you don't have to go through thousands of lines of code to find the method you wrote three months ago. 4. It's the language for which it's easier to work within the Agile methodologies. 5. It's strongly typed without being unnecessarily redundant. 6. It's "wacky" interface releases you from the need to use curlys. 7. It comes with a huge library, so you don't need to reinvent the wheel as much. 8. It's debugger is highly integrated and friendly, so the experience of findin...

c,c++,obj-c
Of the 3 languages titled in this post is c++ older than obj-c ? Would someone experienced in C be able to dive right into C++ rather than obj-c ? Java is out for me now except applet programming I think I'm going to go with just C and C++. Bill Bill Cunningham wrote: > Of the 3 languages titled in this post is c++ older than obj-c ? Why does that matter? Do you want to use an old language? Try Fortran or LISP. > Would > someone experienced in C be able to dive right into C++ rather than > obj-c ? Not quite dive in, at least not into the OO parts of C++. ...

C, C++ and C# Forums
Throne Software has opened up C, C++ and C# Forums at: http://www.thronesoftware.com/forum/ Join us! ...

Index Sort?
Is there a simple way to get the sorted index from a list, rather than the sorted list? ie. Input is: big bear eat little human Output is: 2 1 3 5 4 On Wed, 26 Jan 2005 at 01:27 GMT, Fangz wrote: > Is there a simple way to get the sorted index from a list, rather than > the sorted list? > > ie. Input is: > > big > bear > eat > little > human > > Output is: > > 2 > 1 > 3 > 5 > 4 awk '{printf "%s\t%d\n", $0, NR}' | sort | cut -f2 -- Chris F.A. Johnson http://cfaj.freeshell.org/shell =================================================================== My code (if any) in this post is copyright 2004, Chris F.A. Johnson and may be copied under the terms of the GNU General Public License In article <b1955745.0501251727.54d4d6a1@posting.google.com>, Fangz <zhou.zfang@gmail.com> wrote: >Is there a simple way to get the sorted index from a list, rather than >the sorted list? > >ie. Input is: > >big >bear >eat >little >human > >Output is: > >2 >1 >3 >5 >4 (In [Bourne-ish] shell) WHINY_USERS=1 gawk '{x[$0]=NR}END{for (i in x) print x[i]}' file Fangz wrote: > Is there a simple way to get the sorted index from a list, rather than > the sorted list? > > ie. Input is: > > big > bear > eat > little > human > > Output is: > > 2 > 1 > 3 > 5 > 4...

C++ to C
Are there any open source C++ compilers that will produce C code? I understand the first C++ compilers operated this way. On Mon, 27 Oct 2003 23:07:19 GMT, "Bootstrap Bill" <wrcousert@yahoo.com> wrote in comp.lang.c: > Are there any open source C++ compilers that will produce C code? I > understand the first C++ compilers operated this way. C++ compilers are off-topic in comp.lang.c. -- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq "Bootstrap Bill" <wrcousert@yahoo.com> writes: > Are there any open source C++ compilers that will produce C code? I > understand the first C++ compilers operated this way. You might want to have a look at Comeau - it's not open source, but it's cheap, and AFAIK does exactly what you want (www.comeaucomputing.com) HTH & kind regards frank -- Frank Schmitt 4SC AG phone: +49 89 700763-0 e-mail: frankNO DOT SPAMschmitt AT 4sc DOT com in comp.lang.c i read: >"Bootstrap Bill" <wrcousert@yahoo.com> writes: >> Are there any open source C++ compilers that will produce C code? I >> understand the first C++ compilers operated this way. > >You might want to have a look at Comeau - it's not open source, but >it's cheap, and AFAIK does exactly what you want but note ...

Sorting out sort
I'm trying to extract a column from a flatfile database and print it alphabetically. I can get the data out, but I can't get it to sort. The database is pipe-separated in a plain text file and looks like this: Ref_no|Title|County|Another_field|And_another|And_another 1234|A Name|Devon|Data here|More data here|And more data 1234|A Name|Somerset|Data here|More data here|And more data 1234|A Name|Nottinghamshire|Data here|More data here|And more data 1234|A Name|Essex|Data here|More data here|And more data .... and so on My routine is as follows: #open the file open (INFILE, 'dat...

stop a debugger when a global variable gets modified in c/c++
Hi, How do I stop the debugger (ddd or even gdb will do) when a global variable (or a static variable in a function) gets modified ? Adding a watch on the variable only tells that the variable has changed but not how. "call_me_anything" <sgiitnewid@gmail.com> wrote in message news:1191221980.036783.128480@d55g2000hsg.googlegroups.com... : How do I stop the debugger (ddd or even gdb will do) when a global : variable (or a static variable in a function) gets modified ? : Adding a watch on the variable only tells that the variable has : changed but not how. This is debugger-sp...

How do I get the gnome theme colours from C or C++ (GTK+ and gtkmm)
How do I programatically query the gnome desktop theme? For example, how do I find the current background colour/image/ gradient, or the titlebar colour? (I'm learning gtk+ & gtkmm on Ubuntu 7.04.) Thanks! St=E9phane Charette On Jul 8, 12:22 am, Stephane Charette <stephanechare...@gmail.com> wrote: > How do I programatically query the gnome desktop theme? > > For example, how do I find the current background colour/image/ > gradient, or the titlebar colour? > > (I'm learning gtk+ & gtkmm on Ubuntu 7.04.) > > Thanks! > ...

To get the index
Dear experts i have a matrix A and i wanna get all A(i,i)'s position in the ist column. For instance, matrix A (50*50) Firstly,sort array elements in ascending order: sort(A) how to get the index of A(i,i)(such as A(1,1), A(2,2),A(3,3)) in every column of the sorted matrix?? Cheers! Tina Tina wrote: > Dear experts > i have a matrix A and i wanna get all A(i,i)'s position in the ist > column. > > For instance, matrix A (50*50) > Firstly,sort array elements in ascending order: sort(A) > how to get the index of A(i,i)(such as A(1,1), A(2,2),A(3,3)) in > every ...

how to get index
hello, how to get the index number of a element in vector? for example, a=[4 5 2 9]; element 2 is in the 3rd position of the vector a. how can I do in matlab? I can it below, but it looks awful. a=[4 5 2 9]; b=1:numel(a); b(a==2); does anyone have simpler way? thanks Yuan On Nov 23, 3:20=A0pm, Yuan <jayuan2...@yahoo.com> wrote: > hello, > > how to get the index number of a element in vector? > for example, > a=3D[4 5 2 9]; > element 2 is in the 3rd position of the vector a. how can I do in > matlab? > > I can it below, but it looks awful. > > a=3D...

Web resources about - sort and get index? - comp.lang.c++

Steve Jobs Keynote Index Fund
Back in 2007 (and linked from DF at the time), Matt Haughey had this idea: I wondered what effect the Jobs keynote had on Apple’s stock price ...

Money Flow Index
Tuesday, 26 May 2015 Home About us Contact Information Privacy Policy Terms of Service Menu Home Business Economy US Europe Markets Politics ...

City Index UK - Spread Betting, CFD & FX trading
One of the leading UK providers of spread betting and CFD trading, City Index has over 30 years' industry experience.

California Birth Index - Wikipedia, the free encyclopedia
The California Birth Index ( CABI ) is a database compiled by the California Office of Health Information and Research. The index contains birth ...

Index of /difangxinwen/xxlb_fabu/fbpd_chongqing/201603
Index of /difangxinwen/xxlb_fabu/fbpd_chongqing/201603 Parent Directory t20160301_1994565.html t20160301_1994570.html t20160301_1994578.html ...

Index Ventures has lost 2 investors to a venture capital fund that's run by one of London's most entrepreneurial ...
Index Ventures has lost two tech investors to LocalGlobe — the venture capital company set up by former Index Ventures partner Saul Klein and ...

Index Ventures has lost two investors to a new venture capital fund - Business Insider Deutschland
Robin and Saul Klein are investing £45 million through LocalGlobe. Flickr/Joi Ito LocalGlobe cofounder Saul Klein. Index Ventures has lost two ...

NFIB: Small Business Optimism Index decreased in February
From the National Federation of Independent Business (NFIB): Small Business Optimism Falls Again This Month The Index of Small Business Optimism ...

Here's the problem with index ETFs
Index ETFs have grown in popularity but they aren't always a wise strategy, says Michael Farr. Here's why.

Open thread for night owls: Excerpts from the latest Harper's Index
Here are a few excerpts from the April edition of Harper’s Index: Portion of calls to the IRS help line that went unanswered during last year’s ...

Resources last updated: 3/19/2016 11:16:27 AM