Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: sorting the numbers considering given precisio
Hi,

What is the difference between :

sort(10^precision*A)

and

sort(A)

Seems that I misunderstood something :(
Jérôme

Report this thread to moderator Post Follow-up to this message
Old Post
Jérôme
04-28-05 02:00 PM


Re: sorting the numbers considering given precisio
Jérôme wrote:
>
>
> Hi,
>
> What is the difference between :
>
> sort(10^precision*A)
>
> and
>
> sort(A)
>
> Seems that I misunderstood something :(
> Jérôme

Oops, I forgot the <round>. Doh!

precision=3;
 [idx,idx]=sort(round(10^precision*A),'de
scend');
A_sort=A(idx)

Report this thread to moderator Post Follow-up to this message
Old Post
Steve Amphlett
04-28-05 02:00 PM


Re: sorting the numbers considering given precisio
Steve Amphlett wrote:

>
> Oops, I forgot the <round>. Doh!

> precision=3;
>  [idx,idx]=sort(round(10^precision*A),'de
scend');
> A_sort=A(idx)

OK Steve, perhaps I need coffee but :

what is the difference between :

sort(round(10^precision*A))

and

sort(A)

I take a coffee...
Jérôme

Report this thread to moderator Post Follow-up to this message
Old Post
Jérôme
04-28-05 02:00 PM


Re: sorting the numbers considering given precisio
Jérôme wrote:
>
>
> Steve Amphlett wrote:
> 
> 
>
> OK Steve, perhaps I need coffee but :
>
> what is the difference between :
>
> sort(round(10^precision*A))
>
> and
>
> sort(A)

For the example input given, nothing. But try this:

precision=3;
A=rand(1000,1);
 [idx1,idx1]=sort(round(10^precision*A),'
descend');
[idx2,idx2]=sort(A,'descend');
all(idx1==idx2)

ans =

0 

ans =

628

Report this thread to moderator Post Follow-up to this message
Old Post
Steve Amphlett
04-28-05 02:00 PM


Re: sorting the numbers considering given precisio
After a great black coffee :

I know differences between the two codes you post.
But I think these differences match the "or" in the question :

sortedA = [1.2000;
1.013
1.0123 or 1.0124
1.0124 1.0123
1.0112];

So to me, in that case, both give the same (good) result !

Jérôme

Report this thread to moderator Post Follow-up to this message
Old Post
Jérôme
04-28-05 02:00 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Matlab archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 09:19 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.