Page 2 of 2

Re: Matrix to Series

Posted: Sun Jun 16, 2019 3:55 pm
by ateeb
So about indexing, now i am getting this error:

## MAT13. Store into out-of-range %X(2015,23)
The Error Occurred At Location 898, Line 43 of loop/block

where i have 4 loops, 3 nested inside 1 of them:

The total lines of code I have is 698 lines -

So when it says Error is at location 898 how to locate that? and also when i count the lines 1 to 43 within the loop, should i ignore lines that have descriptions and start with *?

Regards,

Ateeb

Re: Matrix to Series

Posted: Sun Jun 16, 2019 9:53 pm
by TomDoan
The "location" is unlikely to be much help. (We can use it in debugging the software, but it doesn't really help a user). The line count includes comments, and includes continuations---RATS has the line number in the status field at the bottom of the application windows so you just want to go 48 lines down from the DO.

What are you doing with %X? That's a throwback to version 3 or so.

Re: Matrix to Series

Posted: Mon Jun 17, 2019 8:02 am
by ateeb
I found %X to be a good way to setup entries for my variables, I am having hard time understanding how to put variables in columns and observations in rows and doing operations on them ...

Re: Matrix to Series

Posted: Mon Jun 17, 2019 9:55 am
by TomDoan
If you're using %X to do data transformations, you're doing something wrong. You want to keep series as series as long as possible---in most cases, throughout the program. Matrices should be used when you are manipulating them as a whole, not element by element. The MAKE instruction can be used to create a specific matrix out of a specific range of a specific set of series when you need it (though often you don't even need that---instructions like CMOM and MCOV can create most of the important derived matrices without ever directly creating an "X" matrix).

Re: Matrix to Series

Posted: Sat Jun 22, 2019 9:52 am
by Esteban
Hi Tom and everybody,

Thanks for your answers. I have this doubt: How to turn a gset of vectors[2x1] into two different sets separately?. First, I tried doing a loop, but it seems to consume time computing unnecessarily.

Regards.

Re: Matrix to Series

Posted: Sat Jun 22, 2019 11:23 am
by TomDoan
Something like:

dec series[vect] asvects
gset asvects = %ranmat(2,1)
set series1 = asvects(t)(1)
set series2 = asvects(t)(2)