From: Martin on
I would appreciate any help with this:

I enter the following code:

a=[10 30 80 70 40 90 60 20 80]
[aa,bb]=sort(a)
cc=[1:1:9]
dd=[cc-bb]

asking for dd gives me the string

0 -6 1 -1 -4 -1 3 5 3

How do I ask matlab to now put the postion moves under the respective numbers in string a? So it displays as:

0 1 5 3 -1 3 -1 -6 -4

Such that the number of moves made by the number to put it in orde are placed in the position of the respective number in string a, rather than in the prosition of its number once arranged in order.

I hope this makes sense? Any help very much appreciated.

thank you
From: ImageAnalyst on
This is the identical problem that your classmate posted in
http://groups.google.com/group/comp.soft-sys.matlab/browse_frm/thread/5ee6f7719b12a525/0b09942c51a012a2?hl=en#0b09942c51a012a2
Neither one of you admitted in advance that it was your homework.
From: Martin on
Your deductions are wrong.

This is not homework. We are not matlab students.

help appreciated?
From: Oleg Komarov on
"Martin " <oneaccount(a)hotmail.co.uk> wrote in message <hlhh3m$al8$1(a)fred.mathworks.com>...
> Your deductions are wrong.
>
> This is not homework. We are not matlab students.
>
> help appreciated?
In the post linked above I already answered.
You can answer too.

Oleg
From: Martin on
thanks for your pointer.

I tried this and got the string:

0 5 -6 -4 3 3 -1 1 -1

which is not the string that I want. I am hoping to resolve such that I get the string depicted in the question.

Thanks again.