Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 02/19/25 03:24
New Zorro version 2.64
by jcl. 02/17/25 15:32
Smaller Windows version
by Nicole. 02/08/25 14:51
Command Help in notepad++
by pr0logic. 02/07/25 18:19
How to export list of current open trades?
by vicknick. 02/07/25 17:22
Initial RithmicZorroPlugin Release.
by kzhao. 02/05/25 03:30
AUM Magazine
Latest Screens
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Zeal-X2
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 438 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
crazyhedgehog, Nicole, Columboss, quantenesis, YanniD
19109 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: 48
V
vicknick Offline OP
Newbie
vicknick  Offline OP
Newbie
V

Joined: Apr 2023
Posts: 48
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,767
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,767
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: 48
V
vicknick Offline OP
Newbie
vicknick  Offline OP
Newbie
V

Joined: Apr 2023
Posts: 48
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,767
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,767
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