Gamestudio Links
Zorro Links
Newest Posts
Camera always moves upwards?
by clonman. 11/13/25 14:04
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
Training with the R bridge does not work
by frutza. 11/05/25 00:46
Zorro 2.70
by opm. 10/24/25 03:44
Alpaca Plugin v1.4.0
by TipmyPip. 10/20/25 18:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 21,112 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sheliepaley, Blueguy, blobplayintennis, someone2, NotEBspark
19177 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: 60
V
vicknick Offline OP
Junior Member
vicknick  Offline OP
Junior Member
V

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

Joined: Feb 2017
Posts: 1,809
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: 60
V
vicknick Offline OP
Junior Member
vicknick  Offline OP
Junior Member
V

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

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