Gamestudio Links
Zorro Links
Newest Posts
Z strategies
by Fuchs
Yesterday at 17:27
saturation/contrast on different resolution?
by Kartoffel
Yesterday at 13:37
vec_for_vertex gap issue
by Dooley
04/19/18 22:15
FPS Damage effect
by 3run
04/19/18 20:51
website-related suggestions for the webmaster
by Fuchs
04/19/18 19:03
Algorithm for Detrend=SHUFFLE
by kujo
04/19/18 15:24
Separate entry and exit parameters optimization
by kujo
04/19/18 13:27
AUM Magazine
Latest Screens
Forgotten Tales - Demo version
RPG PARTY
Triton Wing now available on Steam
AckCon'17: Lotter vs The World
Who's Online
12 registered (3run, AndrewAMD, PadMalcom, Sphin, Don_Diego, kujo, Fuchs, mk_1, brax, 1 invisible), 501 Guests and 4 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
stuvwx608784, Joderin, Fuchs, Don_Diego, jetomas59
17937 Registered Users
Topic Options
Rate This Topic
#464838 - 03/14/17 18:16 sortIdx
hatten Offline
Newbie

Registered: 07/01/16
Posts: 38
When using sortIdx I run into the problem that this function apparently checks the lookback period and yields and error if the number of elements of the array you wish to sort exceeds the lookback period. However I do wish to sort an array that is not a time series and whose dimension is unrelated to lookback issues. This function should be in file functions.c as it is declared in function.h. Unfortunately function.c is not part of the distribution, otherwise it would be easy to just copy the code for sortIdx and remove checklookback command, which I assume is the problem. Anyone has a code snippet for sorting as sortIdx does? The standard qsort c++ function is different as it rearranges the elements of the original array which I don't want.

Top
#470424 - 01/13/18 16:09 Re: sortIdx [Re: hatten]
sdh309795gaas Offline
Junior Member

Registered: 12/07/14
Posts: 88
Same question here!


This doesn't work:


function main()
{
int n;
var myarray[4] = {1.5, 2.3, 0.1, 0.001};

int Idx = sortIdx(myarray, 4);

for(n=0, n < 4, n++)
{
printf("n%dth Index = %d",n,Idx[n]);
}


}

Top
#470439 - 01/14/18 20:19 Re: sortIdx [Re: sdh309795gaas]
oligodar Offline
Newbie

Registered: 12/08/13
Posts: 8
This code works for me:

Code:
function main(){
	int n;
	var myarray[4] = {1.5, 2.3, 0.1, 0.001};
	int* Idx = sortIdx(myarray, -4);
	for(n=0; n < 4; n++){
	    printf("\n%dth Index = %d",n,Idx[n]);
	}
}




in zorro 1.744


Edited by oligodar (01/14/18 20:24)

Top
#470447 - 01/15/18 10:58 Re: sortIdx [Re: oligodar]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26307
Loc: Frankfurt
AFAIK, sortIdx does not check the lookback period and the number of elements does not matter. Maybe you were using a very old Zorro version.

Top



Gamestudio download | chip programmers | Zorro platform | shop | resources | magazine | manual | support faq | bugs

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) 3dgamestudio.net