Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by Grant. 05/23/26 20:53
Issues resuming trades on Demo account
by Martin_HH. 05/22/26 13:31
XTB
by pr0logic. 05/18/26 12:27
Purchase A8 full licence version
by NeoDumont. 05/13/26 20:17
Black Book, 4th edition
by TipmyPip. 05/11/26 08:40
No errors in the command line
by jcl. 05/08/26 10:59
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (Quad), 2,774 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
jayden, liu, Koti, curry, DeepxKalsi
19220 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Illegal Indirection in Matrix #488517
01/05/25 15:07
01/05/25 15:07
Joined: Apr 2023
Posts: 61
V
vicknick Offline OP
Junior Member
vicknick  Offline OP
Junior Member
V

Joined: Apr 2023
Posts: 61
I tried to place m + 22 for each matrix element. The matrix has N rows and one column.

Code
#define N  31
var m;
mat TrackingErrorMatrix = matrix(N,1);
for(m = 0; m < N; m++)
{
    me(TrackingErrorMatrix, m, 0) = m + 22;
}


But I got the following error code:
Code
Strategy compiling.........
Error in 'line 138: 
illegal indirection
<  me(TrackingErrorMatrix, m, 0) = m + 22;
 >.


I try to search the manual about this error but I am not able to find any. In fact, the manual also assign to each element by using the me() function.

In manual:
Code
for(i=0; i < A->rows; i++)
    for(j=0; j < A->cols; j++)
      me(A,i,j) = i+j;


Last edited by vicknick; 01/05/25 15:10.
Re: Illegal Indirection in Matrix [Re: vicknick] #488518
01/05/25 17:32
01/05/25 17:32
Joined: Feb 2017
Posts: 1,814
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,814
Chicago
Var is a double. Change var m to int m. me() is a macro that accesses elements of a matrix, so int is necessary.

Re: Illegal Indirection in Matrix [Re: AndrewAMD] #488520
01/06/25 14:37
01/06/25 14:37
Joined: Apr 2023
Posts: 61
V
vicknick Offline OP
Junior Member
vicknick  Offline OP
Junior Member
V

Joined: Apr 2023
Posts: 61
Thanks for your reply!

I am wondering if the elements in the matrix can be stored as var? I tried to store var in the matrix, but when I print them out, they are all integers.

Re: Illegal Indirection in Matrix [Re: vicknick] #488521
01/06/25 17:05
01/06/25 17:05
Joined: Feb 2017
Posts: 1,814
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,814
Chicago
Stored as a var? Yes. But your call is trying to access from an array using a var/double (a floating point number), which is nonsense.

If you supply an int, it will be stored as a var anyways.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1